Rename some bound variables
This commit is contained in:
		
							parent
							
								
									771389bbdf
								
							
						
					
					
						commit
						2793385693
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -57,8 +57,8 @@ def save_config():
 | 
				
			||||||
            ipsets = collections.defaultdict(set)
 | 
					            ipsets = collections.defaultdict(set)
 | 
				
			||||||
            for ip, key in wireguard.items():
 | 
					            for ip, key in wireguard.items():
 | 
				
			||||||
                for group in user_groups.get(key.get('user', ''), ()):
 | 
					                for group in user_groups.get(key.get('user', ''), ()):
 | 
				
			||||||
                    for network in groups[group]:
 | 
					                    for name in groups[group]:
 | 
				
			||||||
                        ipsets[network].add(f'{ip}/32')
 | 
					                        ipsets[name].add(f'{ip}/32')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # Create config files.
 | 
					            # Create config files.
 | 
				
			||||||
            output = pathlib.Path.home() / 'config' / f'{version}'
 | 
					            output = pathlib.Path.home() / 'config' / f'{version}'
 | 
				
			||||||
| 
						 | 
					@ -75,8 +75,8 @@ set {name} {{
 | 
				
			||||||
    typeof ip daddr; flags interval
 | 
					    typeof ip daddr; flags interval
 | 
				
			||||||
    elements = {{ {', '.join(ips)} }}
 | 
					    elements = {{ {', '.join(ips)} }}
 | 
				
			||||||
}}'''
 | 
					}}'''
 | 
				
			||||||
                for name, networks in ipsets.items():
 | 
					                for name, ips in ipsets.items():
 | 
				
			||||||
                    print(format_set(name, networks), file=f)
 | 
					                    print(format_set(name, ips), file=f)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # Print forwarding rules.
 | 
					            # Print forwarding rules.
 | 
				
			||||||
            with open(f'{output}/etc/nftables.d/forward.nft', 'w', encoding='utf-8') as f:
 | 
					            with open(f'{output}/etc/nftables.d/forward.nft', 'w', encoding='utf-8') as f:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue