From be4dff85be9a2ce8dcd7d329c0965c2620ec98f4 Mon Sep 17 00:00:00 2001 From: danthe1st Date: Fri, 8 Mar 2024 19:39:28 +0100 Subject: [PATCH] rename host matcher config --- .../httpsintercept/config/HostMatcherConfig.java | 14 +++++++------- .../matcher/IterativeHostMatcher.java | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/io/github/danthe1st/httpsintercept/config/HostMatcherConfig.java b/src/main/java/io/github/danthe1st/httpsintercept/config/HostMatcherConfig.java index 1302443..cf877cd 100644 --- a/src/main/java/io/github/danthe1st/httpsintercept/config/HostMatcherConfig.java +++ b/src/main/java/io/github/danthe1st/httpsintercept/config/HostMatcherConfig.java @@ -3,14 +3,14 @@ import java.util.Collections; import java.util.Set; -public record HostMatcherConfig(Set exactHosts, - Set hostParts, - Set hostRegexes) { +public record HostMatcherConfig(Set exact, + Set partial, + Set regex) { - public HostMatcherConfig(Set exactHosts, Set hostParts, Set hostRegexes) { - this.exactHosts = emptyIfNull(exactHosts); - this.hostParts = emptyIfNull(hostParts); - this.hostRegexes = emptyIfNull(hostRegexes); + public HostMatcherConfig(Set exact, Set partial, Set regex) { + this.exact = emptyIfNull(exact); + this.partial = emptyIfNull(partial); + this.regex = emptyIfNull(regex); } private Set emptyIfNull(Set data) { diff --git a/src/main/java/io/github/danthe1st/httpsintercept/matcher/IterativeHostMatcher.java b/src/main/java/io/github/danthe1st/httpsintercept/matcher/IterativeHostMatcher.java index c2dde4d..4815f2e 100644 --- a/src/main/java/io/github/danthe1st/httpsintercept/matcher/IterativeHostMatcher.java +++ b/src/main/java/io/github/danthe1st/httpsintercept/matcher/IterativeHostMatcher.java @@ -29,12 +29,12 @@ public IterativeHostMatcher(List> configs) { for(Map.Entry entry : configs){ HostMatcherConfig config = entry.getKey(); T value = entry.getValue(); - if(config.exactHosts().isEmpty() && config.hostParts().isEmpty() && config.hostRegexes().isEmpty()){ + if(config.exact().isEmpty() && config.partial().isEmpty() && config.regex().isEmpty()){ wildcardElements.add(value); }else{ - addToMap(hosts, value, config.exactHosts(), Function.identity()); - addToMap(parts, value, config.hostParts(), Function.identity()); - addToMap(regexes, value, config.hostRegexes(), Pattern::compile); + addToMap(hosts, value, config.exact(), Function.identity()); + addToMap(parts, value, config.partial(), Function.identity()); + addToMap(regexes, value, config.regex(), Pattern::compile); } } this.exactHosts = toImmutable(hosts);