Documentation ¶
Overview ¶
Package webtunnelcommon package has common utils/structs for client/server
Index ¶
- func GenMACAddr() net.HardwareAddr
- func GetIntCfg(name string) (net.HardwareAddr, []net.IP, error)
- func GetMacbyName(name string) net.HardwareAddr
- func IsConfigured(ifName string, ip string) bool
- func PrintPacketEth(pkt []byte, tag string)
- func PrintPacketIPv4(pkt []byte, tag string)
- type ClientConfig
- type Interface
- type ServerInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenMACAddr ¶
func GenMACAddr() net.HardwareAddr
GenMACAddr generate a random private MAC address for GW server to handle ARP etc.
func GetMacbyName ¶
func GetMacbyName(name string) net.HardwareAddr
GetMacbyName returns the mac address of the interface by name. eg. eth0.
func IsConfigured ¶
IsConfigured checks if interface ifName is configured with ip.
func PrintPacketEth ¶
PrintPacketEth prints the Ethernet packet.
func PrintPacketIPv4 ¶
PrintPacketIPv4 prints the IPv4 packet.
Types ¶
type ClientConfig ¶
type ClientConfig struct { IP string `json:"ip"` // IP address of client. Netmask string `json:"netmask"` // Netmask of interface. RoutePrefix []string `json:"routeprefix"` // Network prefix to route. GWIp string `json:"gwip"` // Gateway IP address. DNS []string `json:"dns"` // DNS IPs ServerInfo *ServerInfo `json:"serverinfo"` // Server Information for debug or troubleshooting }
ClientConfig represents the struct to pass config from server to client.
type Interface ¶
type Interface interface { io.ReadWriteCloser IsTUN() bool IsTAP() bool Name() string }
Interface represents the network interface.
type ServerInfo ¶
type ServerInfo struct { Hostname string `json:"hostname"` // for now only provide gw hostname to client Session string `json:"session"` // session tracker from server }
ServerInfo represents the struct provided to the client for debuging purpose
Click to show internal directories.
Click to hide internal directories.