net

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RouteArg                    = "%s via %s dev %s metric 50"
	BackupAndDelStaticRouteFile = `` /* 207-byte string literal not displayed */

	AddStaticRouteFile = `cat /etc/sysconfig/network-scripts/route-%s|grep "%s" || echo "%s" >> /etc/sysconfig/network-scripts/route-%s`
)
View Source
const (
	RouteOK     = "ok"
	RouteFailed = "failed"
)

Variables

View Source
var ErrNotIPV4 = errors.New("IP addresses are not IPV4 rules")

Functions

func CheckIsDefaultRoute

func CheckIsDefaultRoute(host net.IP) error

func CompareIP

func CompareIP(v1, v2 string) int

func GetHostNetInterface

func GetHostNetInterface(host net.IP) (string, error)

func GetIndexIP added in v0.9.3

func GetIndexIP(subnet *net.IPNet, index int) (string, error)

func GetLocalDefaultIP

func GetLocalDefaultIP() (string, error)

func GetLocalHostAddresses

func GetLocalHostAddresses() ([]net.Addr, error)

func GetLocalIP

func GetLocalIP(master0IPPort string) (net.IP, error)

func IPStrsToIPs

func IPStrsToIPs(ipStrs []string) []net.IP

func IPToInt

func IPToInt(v string) *big.Int

func IPsToIPStrs

func IPsToIPStrs(ips []net.IP) []string

func IsInIPList added in v0.9.0

func IsInIPList(key net.IP, slice []net.IP) bool

func IsIpv4

func IsIpv4(ip string) bool

func IsLocalIP

func IsLocalIP(ip net.IP, addrs []net.Addr) bool

func NextIP

func NextIP(ip string) net.IP

func RemoveIPs added in v0.9.0

func RemoveIPs(clusterIPList []net.IP, toBeDeletedIPList []net.IP) (res []net.IP)

func SortIPList

func SortIPList(iplist []string)

func TransferToIPList added in v0.9.0

func TransferToIPList(ipStr string) (string, error)

TransferToIPList transfer network segment string to ip list string

Types

type Route

type Route struct {
	Host    net.IP
	Gateway net.IP
}

func NewRouter

func NewRouter(host, gateway net.IP) *Route

func (*Route) DelRoute

func (r *Route) DelRoute() error

DelRoute ip route del $route

func (*Route) SetRoute

func (r *Route) SetRoute() error

SetRoute ip route add $route

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL