Files
go-gateway/gateway.go
T
2022-08-27 02:26:00 +08:00

24 lines
615 B
Go

package gateway
import (
"errors"
"net"
"runtime"
)
var (
errNoGateway = errors.New("no gateway found")
errCantParse = errors.New("can't parse string output")
errNotImplemented = errors.New("not implemented for OS: " + runtime.GOOS)
)
// DiscoverGatewayIPv4 is the OS independent function to get the default ipv4 gateway
func DiscoverGatewayIPv4() (ip net.IP, err error) {
return discoverGatewayOSSpecificIPv4()
}
// DiscoverGatewayIPv6 is the OS independent function to get the default ipv6 gateway
func DiscoverGatewayIPv6() (ip net.IP, err error) {
return discoverGatewayOSSpecificIPv6()
}