Documentation ¶
Index ¶
- Variables
- func AddNicRoutes(routes [][]string, nicDesc *types.SServerNic, mainIp string, nicCnt int) [][]string
- func DefaultSrcIpDev() (srcIp net.IP, ifname string, err error)
- func ExpandCompactIps(ipstr string) ([]string, error)
- func FormatMac(macStr string) string
- func GetFreePort() (int, error)
- func GetHttpRequestIp(r *http.Request) string
- func GetMainNicFromDeployApi(nics []*types.SServerNic) (*types.SServerNic, error)
- func GetNicDns(nicdesc *types.SServerNic) []string
- func GetPrivatePrefixes(privatePrefixes []string) []string
- func GetSecretInterfaceAddress() (string, int)
- func IsTcpPortUsed(addr string, port int) bool
- func MacEqual(mac1, mac2 string) bool
- func MyIP() (ip string, err error)
- func MyIPTo(dstIP string) (ip string, err error)
- func NetBytes2Mask(mask []byte) string
- func Netlen2Mask(netmasklen int) string
- func Netmask2Len(mask string) int
- func PrefixSplit(pref string) (string, int, error)
- func TestTcpPort(ip string, port int, timeoutSecs int, tries int) error
- func WaitIfaceIps(ifname string) (*net.Interface, []net.IP, error)
- type SBondingConfig
- type SNetInterface
- func (n *SNetInterface) ClearAddrs() error
- func (n *SNetInterface) Exist() bool
- func (n *SNetInterface) FetchConfig()
- func (n *SNetInterface) FetchInter() *net.Interface
- func (n *SNetInterface) GetAddresses() [][]string
- func (n *SNetInterface) GetAllMacs() []string
- func (n *SNetInterface) GetMac() string
- func (n *SNetInterface) GetRouteSpecs() []iproute2.RouteSpec
- func (n *SNetInterface) GetSlaveAddresses() [][]string
- func (n *SNetInterface) IsSecretAddress(addr string, mask []byte) bool
- func (n *SNetInterface) IsSecretInterface() bool
- func (n *SNetInterface) SetupGso(on bool)
- func (n *SNetInterface) String() string
- type SNicInfo
- type SNicInfoList
- type SVlanConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SECRET_PREFIX = "169.254" SECRET_MASK = []byte{255, 255, 255, 255} SECRET_MASK_LEN = 32 )
View Source
var PRIVATE_PREFIXES = []string{
"10.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
}
View Source
var PSEUDO_VIP = "169.254.169.231"
Functions ¶
func AddNicRoutes ¶
func ExpandCompactIps ¶
func GetFreePort ¶
func GetHttpRequestIp ¶
func GetMainNicFromDeployApi ¶
func GetMainNicFromDeployApi(nics []*types.SServerNic) (*types.SServerNic, error)
func GetNicDns ¶
func GetNicDns(nicdesc *types.SServerNic) []string
func GetPrivatePrefixes ¶
func IsTcpPortUsed ¶
func NetBytes2Mask ¶
func Netlen2Mask ¶
func Netmask2Len ¶
Types ¶
type SBondingConfig ¶
type SNetInterface ¶
type SNetInterface struct { Addr string Mask net.IPMask Mtu int VlanId int VlanParent *SNetInterface BondingMode int BondingSlaves []*SNetInterface // contains filtered or unexported fields }
func NewNetInterface ¶
func NewNetInterface(name string) *SNetInterface
func NewNetInterfaceWithExpectIp ¶
func NewNetInterfaceWithExpectIp(name string, expectIp string) *SNetInterface
func (*SNetInterface) ClearAddrs ¶
func (n *SNetInterface) ClearAddrs() error
func (*SNetInterface) Exist ¶
func (n *SNetInterface) Exist() bool
func (*SNetInterface) FetchConfig ¶
func (n *SNetInterface) FetchConfig()
func (*SNetInterface) FetchInter ¶
func (n *SNetInterface) FetchInter() *net.Interface
func (*SNetInterface) GetAddresses ¶
func (n *SNetInterface) GetAddresses() [][]string
func (*SNetInterface) GetAllMacs ¶
func (n *SNetInterface) GetAllMacs() []string
func (*SNetInterface) GetMac ¶
func (n *SNetInterface) GetMac() string
func (*SNetInterface) GetRouteSpecs ¶
func (n *SNetInterface) GetRouteSpecs() []iproute2.RouteSpec
func (*SNetInterface) GetSlaveAddresses ¶
func (n *SNetInterface) GetSlaveAddresses() [][]string
func (*SNetInterface) IsSecretAddress ¶
func (n *SNetInterface) IsSecretAddress(addr string, mask []byte) bool
func (*SNetInterface) IsSecretInterface ¶
func (n *SNetInterface) IsSecretInterface() bool
func (*SNetInterface) SetupGso ¶
func (n *SNetInterface) SetupGso(on bool)
https://kris.io/2015/10/01/kvm-network-performance-tso-and-gso-turn-it-off/ General speaking, it is recommended to turn of GSO however, this will degrade host network performance
func (*SNetInterface) String ¶
func (n *SNetInterface) String() string
type SNicInfoList ¶
type SNicInfoList []SNicInfo
func (SNicInfoList) Add ¶
func (nics SNicInfoList) Add(ip, mac, gw string) SNicInfoList
func (SNicInfoList) FindDefaultNicMac ¶
func (nics SNicInfoList) FindDefaultNicMac() (string, int)
type SVlanConfig ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.