chore(bird): Fix None flag

This commit is contained in:
v-lafeychine 2024-04-01 00:13:22 +02:00
parent ba033f9099
commit 54d227232b
Signed by: v-lafeychine
GPG key ID: F46CAAD27C7AB0D5

View file

@ -99,7 +99,7 @@ class IPFlag(str):
pattern = r"(?P<ip>.*?)(?P<flag>[+-]|\{[0-9]+,[0-9]+\})?$"
parts = re.match(pattern, v)
return (ip_network(parts.group("ip")), parts.group("flag"))
return (ip_network(parts.group("ip")), parts.group("flag") or "")
class NetMatch(BaseModel):
@ -245,7 +245,7 @@ def str_of_condition(condition: Condition, ctx: bool) -> str:
m for m in matches if isinstance(m[0], IPv6Network)
]
return f"net ~ [ {', '.join([f'{network}{str(flag)}' for (network, flag) in networks])} ]"
return f"net ~ [ {', '.join([f'{network}{flag}' for (network, flag) in networks])} ]"
def lines_of_action(action: Action, ctx: Context) -> Iterable[str]: