Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GB2312toUTF8 ¶
Types ¶
type Interface ¶
type Interface interface { // EnsurePortProxyRule checks if the specified redirect exists, if not creates it EnsurePortProxyRule(args []string) (bool, error) // DeletePortProxyRule deletes the specified portproxy rule. If the rule did not exist, return error. DeletePortProxyRule(args []string) error // DeleteIPAddress checks if the specified IP address is present and, if so, deletes it. DeleteIPAddress(args []string) error // Restore runs `netsh exec` to restore portproxy or addresses using a file. // TODO Check if this is required, most likely not Restore(args []string) error // Get the interface name that has the default gateway GetDefaultGatewayIfaceName() (string, error) // Get a list of interfaces and addresses GetInterfaces() ([]Ipv4Interface, error) // Gets an interface by name GetInterfaceByName(name string) (Ipv4Interface, error) // Gets an interface by ip address in the format a.b.c.d GetInterfaceByIP(ipAddr string) (Ipv4Interface, error) // 设置静态ip, 会替换当前网卡的静态ip // ip 格式 10.0.0.2/24 SetIPAddress(iface string, address string) error // 添加ip AddIPAddress(iface string, address string) error // Enable forwarding on the interface (name or index) EnableForwarding(iface string) error // Set the DNS server for interface SetDNSServer(iface string, dns string) error }
Interface is an injectable interface for running netsh commands. Implementations must be goroutine-safe.
Click to show internal directories.
Click to hide internal directories.