mirror of
https://github.com/quantum5/bird-filter.git
synced 2025-04-24 00:51:57 -04:00
Use bird sets instead of cases
This commit is contained in:
parent
8395181020
commit
52b52aa536
|
@ -8,18 +8,11 @@ def generate_bird(aspas: list[ASPA]) -> str:
|
|||
]
|
||||
|
||||
for aspa in aspas:
|
||||
if not aspa.providers:
|
||||
if aspa.providers:
|
||||
asns = ', '.join(map(str, aspa.providers))
|
||||
lines.append(f' {aspa.customer}: if upstream_asn !~ [{asns}] then return true;')
|
||||
else:
|
||||
lines.append(f' {aspa.customer}: return true;')
|
||||
continue
|
||||
|
||||
lines.append(f' {aspa.customer}: case upstream_asn {{')
|
||||
for provider in aspa.providers:
|
||||
lines.append(f' {provider}: {{}}')
|
||||
|
||||
lines += [
|
||||
' else: return true;',
|
||||
' }'
|
||||
]
|
||||
|
||||
lines += [
|
||||
' }',
|
||||
|
|
Loading…
Reference in a new issue