File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,7 +61,8 @@ filter:
6161* **`prefix`** (Single String): CIDR subnet. The address must be contained within this subnet.
6262 * Example: `2001:db8::/32`
6363* **`suffix`** (Single String): The host part (suffix) of the address.
64- * Example: `::1` (Matches `2001:db8::1`, `fe80::1`, etc.)
64+ * Case-insensitive. The filter matches against the lowercase, RFC 5952 canonical representation of the address.
65+ * Example: `::1` (Matches `2001:db8::1`, `fe80::1`, etc.) or `dead:beef` (Matches `...:DEAD:BEEF`)
6566* **`type`** (List of Strings): Match semantic IP types. All types must match.
6667 * Values:
6768 * `global`: Global Unicast Address (Publicly routable).
Original file line number Diff line number Diff line change @@ -170,18 +170,18 @@ func isEUI64(addr *ipv6disc.Addr) bool {
170170 return bytes .Equal (iid , eui64 )
171171}
172172
173- func CheckPrefix (ip netip.Addr , subnet netip.Prefix ) bool {
174- if ! subnet .IsValid () {
173+ func CheckPrefix (ip netip.Addr , prefix netip.Prefix ) bool {
174+ if ! prefix .IsValid () {
175175 return true
176176 }
177- return subnet .Contains (ip )
177+ return prefix .Contains (ip . WithZone ( "" ) )
178178}
179179
180180func CheckSuffix (ip netip.Addr , suffix string ) bool {
181181 if suffix == "" {
182182 return true
183183 }
184- return strings .HasSuffix (ip .String (), suffix )
184+ return strings .HasSuffix (ip .WithZone ( "" ). String (), strings . ToLower ( suffix ) )
185185}
186186
187187func CheckMask (ip netip.Addr , filters []string ) bool {
You can’t perform that action at this time.
0 commit comments