Documentation
¶
Index ¶
- Variables
- func AddIPRouteToNetInterface(ipOrIPAddrs any, ifaceName string) error
- func AddSpecificIPRouteToNetInterface(ipStr string, interfaceName string) error
- func BatchAddSpecificIPRouteToNetInterface(ipList []string, interfaceName string) (success []string, failed map[string]error)
- func BatchDeleteSpecificIPRoute(ipList []string) (success []string, failed map[string]error)
- func DeleteAllRoutesForInterface(interfaceName string) (success []string, failed map[string]error, err error)
- func DeleteIPRoute(ipOrIPAddrs any) error
- func DeleteIPRouteFromNetInterface(ifaceName string) error
- func DeleteSpecificIPRoute(ipStr string) error
- func FindInterfaceByIP(ip string) (net.Interface, error)
- func GetPublicHost() (net.IP, error)
- func GetPublicRoute() (*net.Interface, net.IP, net.IP, error)
- func GetPublicRouteIfaceName() (string, error)
- func IsPrivateIPString(target string) bool
- func Route(timeout time.Duration, target string) (iface *net.Interface, gateway, preferredSrc net.IP, err error)
- type GrokResult
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DarwinGetawayExtractorRe = regexp2.MustCompile(`gateway: ([\[\]0-9a-fA-TaskFunc:\.]+)`, regexp2.IgnoreCase|regexp2.Multiline) DarwinInterfaceExtractorRe = regexp2.MustCompile(`interface: ([^\s]+)`, regexp2.IgnoreCase|regexp2.Multiline) )
View Source
var Exports = map[string]any{ "AddIPRouteToNetInterface": AddIPRouteToNetInterface, "DeleteIPRoute": DeleteIPRoute, "DeleteIPRouteFromNetInterface": DeleteIPRouteFromNetInterface, "AddSpecificIPRouteToNetInterface": AddSpecificIPRouteToNetInterface, "DeleteSpecificIPRoute": DeleteSpecificIPRoute, "BatchAddSpecificIPRouteToNetInterface": BatchAddSpecificIPRouteToNetInterface, "BatchDeleteSpecificIPRoute": BatchDeleteSpecificIPRoute, "DeleteAllRoutesForInterface": DeleteAllRoutesForInterface, }
Functions ¶
func AddIPRouteToNetInterface ¶
AddIPRouteToNetInterface 添加IP路由到网络接口 支持单个IP(string)或多个IP([]string 或任何可转换的切片类型) ipOrIPAddrs: IP地址,支持 string、[]string 或通过 InterfaceToStringSlice 转换的类型 ifaceName: 网络接口名称
func AddSpecificIPRouteToNetInterface ¶
AddSpecificIPRouteToNetInterface 添加单个IP到特定网络接口的路由(仅支持 macOS)
func BatchAddSpecificIPRouteToNetInterface ¶
func BatchAddSpecificIPRouteToNetInterface(ipList []string, interfaceName string) (success []string, failed map[string]error)
BatchAddSpecificIPRouteToNetInterface 批量添加多个IP到特定网络接口的路由(仅支持 macOS)
func BatchDeleteSpecificIPRoute ¶
BatchDeleteSpecificIPRoute 批量删除多个IP的路由(仅支持 macOS)
func DeleteAllRoutesForInterface ¶
func DeleteAllRoutesForInterface(interfaceName string) (success []string, failed map[string]error, err error)
DeleteAllRoutesForInterface 删除特定网络接口的所有/32主机路由(仅支持 macOS)
func DeleteIPRoute ¶
DeleteIPRoute 删除IP路由 支持单个IP(string)或多个IP([]string 或任何可转换的切片类型) ipOrIPAddrs: IP地址,支持 string、[]string 或通过 InterfaceToStringSlice 转换的类型
func DeleteIPRouteFromNetInterface ¶
DeleteIPRouteFromNetInterface 删除网络接口的所有/32主机路由 ifaceName: 网络接口名称
func DeleteSpecificIPRoute ¶
DeleteSpecificIPRoute 删除单个IP的路由(仅支持 macOS)
func GetPublicHost ¶
func GetPublicRouteIfaceName ¶
func IsPrivateIPString ¶
Types ¶
type GrokResult ¶
func Grok ¶
func Grok(line string, rule string) GrokResult
func (GrokResult) Get ¶
func (g GrokResult) Get(key string) string
func (GrokResult) GetAll ¶
func (g GrokResult) GetAll(key string) []string
Click to show internal directories.
Click to hide internal directories.