netutils

package
v0.0.0-...-a954c3e Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetImpl

type NetImpl struct{}

func (*NetImpl) AddrConv

func (n *NetImpl) AddrConv(hostCIDR string, pos int) (string, error)

AddrConv generates <pos> th IP from hostCIDR

func (*NetImpl) GetHostPrimaryIp

func (n *NetImpl) GetHostPrimaryIp(ipFam int) (string, error)

Gets the host's IP address associated with the default gateway

func (*NetImpl) GetNodeIP

func (n *NetImpl) GetNodeIP(v6Enabled bool) (string, error)

GetNodeIP returns routed network interface IP

func (*NetImpl) GetNodeIdentifier

func (n *NetImpl) GetNodeIdentifier(cfg config.Config) (string, error)

GetNodeIdentifier returns node identifier as Hostname / Node IP

func (*NetImpl) IpForHttp

func (n *NetImpl) IpForHttp(masterIp string) (string, error)

IpForHttp returns formatted Ip If IP is IPv4 returns as it is, If IP is IPv6 returns IP with square bracks

type NetInterface

type NetInterface interface {
	AddrConv(string, int) (string, error)
	IpForHttp(string) (string, error)
	GetNodeIP(bool) (string, error)
	GetHostPrimaryIp(int) (string, error)
	GetNodeIdentifier(config.Config) (string, error)
}

func New

func New() NetInterface

Jump to

Keyboard shortcuts

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