mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 11:15:07 +03:00 
			
		
		
		
	Add getTunTap to admin socket
This commit is contained in:
		
							parent
							
								
									6d944d8ec8
								
							
						
					
					
						commit
						5299783e35
					
				
					 1 changed files with 18 additions and 0 deletions
				
			
		| 
						 | 
					@ -73,6 +73,24 @@ func (a *admin) init(c *Core, listenaddr string) {
 | 
				
			||||||
			*out = []byte("Failed to remove peer: " + sport[0] + "\n")
 | 
								*out = []byte("Failed to remove peer: " + sport[0] + "\n")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
 | 
						a.addHandler("getTunTap", nil, func(out *[]byte, _ ...string) {
 | 
				
			||||||
 | 
							var info admin_nodeInfo
 | 
				
			||||||
 | 
							defer func() {
 | 
				
			||||||
 | 
								if r := recover(); r != nil {
 | 
				
			||||||
 | 
									info = admin_nodeInfo{
 | 
				
			||||||
 | 
										{"Interface name", "none"},
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									*out = []byte(a.printInfos([]admin_nodeInfo{info}))
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							info = admin_nodeInfo{
 | 
				
			||||||
 | 
								{"Interface name", a.core.tun.iface.Name()},
 | 
				
			||||||
 | 
								{"TAP mode", strconv.FormatBool(a.core.tun.iface.IsTAP())},
 | 
				
			||||||
 | 
								{"MTU", strconv.Itoa(a.core.tun.mtu)},
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							*out = []byte(a.printInfos([]admin_nodeInfo{info}))
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
	a.addHandler("setTunTap", []string{"<ifname|auto|none>", "[<tun|tap>]", "[<mtu>]"}, func(out *[]byte, ifparams ...string) {
 | 
						a.addHandler("setTunTap", []string{"<ifname|auto|none>", "[<tun|tap>]", "[<mtu>]"}, func(out *[]byte, ifparams ...string) {
 | 
				
			||||||
		// Set sane defaults
 | 
							// Set sane defaults
 | 
				
			||||||
		iftapmode := false
 | 
							iftapmode := false
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue