Use configs for iface
This commit is contained in:
		
							parent
							
								
									67b698f982
								
							
						
					
					
						commit
						1fc2bbe8dc
					
				
					 3 changed files with 12 additions and 6 deletions
				
			
		|  | @ -3,5 +3,8 @@ | ||||||
|   "address": "127.0.0.1", |   "address": "127.0.0.1", | ||||||
|   "port": 12345, |   "port": 12345, | ||||||
|   "iface_name": "tun0", |   "iface_name": "tun0", | ||||||
|   "iface_mtu": 1500 |   "iface_mtu": 1500, | ||||||
|  |   "iface_addr": "10.0.0.1", | ||||||
|  |   "iface_dstaddr": "10.0.0.2", | ||||||
|  |   "iface_netmask": "255.255.255.0" | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -3,5 +3,8 @@ | ||||||
|   "address": "0.0.0.0", |   "address": "0.0.0.0", | ||||||
|   "port": 12345, |   "port": 12345, | ||||||
|   "iface_name": "tun1", |   "iface_name": "tun1", | ||||||
|   "iface_mtu": 1500 |   "iface_mtu": 1500, | ||||||
|  |   "iface_addr": "10.0.0.2", | ||||||
|  |   "iface_dstaddr": "10.0.0.1", | ||||||
|  |   "iface_netmask": "255.255.255.0" | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										8
									
								
								main.py
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								main.py
									
										
									
									
									
								
							|  | @ -35,10 +35,10 @@ def main(): | ||||||
| 
 | 
 | ||||||
|     print(tun_iface.name) |     print(tun_iface.name) | ||||||
| 
 | 
 | ||||||
|     tun_iface.addr = '10.0.0.1' |     tun_iface.addr    = config['iface_addr'] | ||||||
|     tun_iface.dstaddr = '10.0.0.2' |     tun_iface.dstaddr = config['iface_dstaddr'] | ||||||
|     tun_iface.netmask = '255.255.255.0' |     tun_iface.netmask = config['iface_netmask'] | ||||||
|     tun_iface.mtu = 1500 |     tun_iface.mtu     = config['iface_mtu'] | ||||||
| 
 | 
 | ||||||
|     tun_iface.up() |     tun_iface.up() | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Alex Kotov
						Alex Kotov