Documentation ¶
Index ¶
- Constants
- func ARPSendGratuitous(address, ifaceName string) error
- func DeleteExistingSessions(sessionIP string, destination bool, destinationPorts, srcPorts string) error
- func GarbageCollect(adapter, address string) (found bool, err error)
- func GenerateMac() (mac string)
- func GetDefaultGatewayInterface() (*net.Interface, error)
- func GetFullMask(address string) (string, error)
- func GetIPs(vip string) []string
- func IsIP(address string) bool
- func IsIPv4(address string) bool
- func IsIPv6(address string) bool
- func ListRoutes(table, protocol int) ([]netlink.Route, error)
- func ListRoutesByDst(table int, dst *net.IPNet) ([]netlink.Route, error)
- func LookupHost(dnsName, dnsMode string) ([]string, error)
- func MonitorDefaultInterface(ctx context.Context, defaultIF *net.Interface) error
- type DDNSManager
- type DHCPClient
- type Egress
- func (e *Egress) AppendReturnRulesForDestinationSubnet(name, subnet string) error
- func (e *Egress) AppendReturnRulesForMarking(name, subnet string) error
- func (e *Egress) CheckMangleChain(name string) (bool, error)
- func (e *Egress) CleanIPtables() error
- func (e *Egress) CreateMangleChain(name string) error
- func (e *Egress) DeleteMangleChain(name string) error
- func (e *Egress) DeleteMangleMarking(podIP, name string) error
- func (e *Egress) DeleteManglePrerouting(name string) error
- func (e *Egress) DeleteSourceNat(podIP, vip string) error
- func (e *Egress) DeleteSourceNatForDestinationPort(podIP, vip, port, proto string) error
- func (e *Egress) DumpChain(name string) error
- func (e *Egress) InsertMangeTableIntoPrerouting(name string) error
- func (e *Egress) InsertSourceNat(vip, podIP string) error
- func (e *Egress) InsertSourceNatForDestinationPort(vip, podIP, port, proto string) error
- type IPUpdater
- type NdpResponder
- type Network
Constants ¶
const ( ProtocolIP = 0 // IPv4 encapsulation, pseudo protocol number ProtocolHOPOPT = 0 // IPv6 Hop-by-Hop Option ProtocolICMP = 1 // Internet Control Message ProtocolIGMP = 2 // Internet Group Management ProtocolGGP = 3 // Gateway-to-Gateway ProtocolIPv4 = 4 // IPv4 encapsulation ProtocolST = 5 // Stream ProtocolTCP = 6 // Transmission Control ProtocolCBT = 7 // CBT ProtocolEGP = 8 // Exterior Gateway Protocol ProtocolIGP = 9 // any private interior gateway (used by Cisco for their IGRP) ProtocolBBNRCCMON = 10 // BBN RCC Monitoring ProtocolNVPII = 11 // Network Voice Protocol ProtocolPUP = 12 // PUP ProtocolEMCON = 14 // EMCON ProtocolXNET = 15 // Cross Net Debugger ProtocolCHAOS = 16 // Chaos ProtocolUDP = 17 // User Datagram ProtocolMUX = 18 // Multiplexing ProtocolDCNMEAS = 19 // DCN Measurement Subsystems ProtocolHMP = 20 // Host Monitoring ProtocolPRM = 21 // Packet Radio Measurement ProtocolXNSIDP = 22 // XEROX NS IDP ProtocolTRUNK1 = 23 // Trunk-1 ProtocolTRUNK2 = 24 // Trunk-2 ProtocolLEAF1 = 25 // Leaf-1 ProtocolLEAF2 = 26 // Leaf-2 ProtocolRDP = 27 // Reliable Data Protocol ProtocolIRTP = 28 // Internet Reliable Transaction ProtocolISOTP4 = 29 // ISO Transport Protocol Class 4 ProtocolNETBLT = 30 // Bulk Data Transfer Protocol ProtocolMFENSP = 31 // MFE Network Services Protocol ProtocolMERITINP = 32 // MERIT Internodal Protocol ProtocolDCCP = 33 // Datagram Congestion Control Protocol Protocol3PC = 34 // Third Party Connect Protocol ProtocolIDPR = 35 // Inter-Domain Policy Routing Protocol ProtocolXTP = 36 // XTP ProtocolDDP = 37 // Datagram Delivery Protocol ProtocolIDPRCMTP = 38 // IDPR Control Message Transport Proto ProtocolTPPP = 39 // TP++ Transport Protocol ProtocolIL = 40 // IL Transport Protocol ProtocolIPv6 = 41 // IPv6 encapsulation ProtocolSDRP = 42 // Source Demand Routing Protocol ProtocolIPv6Route = 43 // Routing Header for IPv6 ProtocolIPv6Frag = 44 // Fragment Header for IPv6 ProtocolIDRP = 45 // Inter-Domain Routing Protocol ProtocolRSVP = 46 // Reservation Protocol ProtocolGRE = 47 // Generic Routing Encapsulation ProtocolDSR = 48 // Dynamic Source Routing Protocol ProtocolBNA = 49 // BNA ProtocolESP = 50 // Encap Security Payload ProtocolAH = 51 // Authentication Header ProtocolINLSP = 52 // Integrated Net Layer Security TUBA ProtocolNARP = 54 // NBMA Address Resolution Protocol ProtocolMOBILE = 55 // IP Mobility ProtocolTLSP = 56 // Transport Layer Security Protocol using Kryptonet key management ProtocolSKIP = 57 // SKIP ProtocolIPv6ICMP = 58 // ICMP for IPv6 ProtocolIPv6NoNxt = 59 // No Next Header for IPv6 ProtocolIPv6Opts = 60 // Destination Options for IPv6 ProtocolCFTP = 62 // CFTP ProtocolSATEXPAK = 64 // SATNET and Backroom EXPAK ProtocolKRYPTOLAN = 65 // Kryptolan ProtocolRVD = 66 // MIT Remote Virtual Disk Protocol ProtocolIPPC = 67 // Internet Pluribus Packet Core ProtocolSATMON = 69 // SATNET Monitoring ProtocolVISA = 70 // VISA Protocol ProtocolIPCV = 71 // Internet Packet Core Utility ProtocolCPNX = 72 // Computer Protocol Network Executive ProtocolCPHB = 73 // Computer Protocol Heart Beat ProtocolWSN = 74 // Wang Span Network ProtocolPVP = 75 // Packet Video Protocol ProtocolBRSATMON = 76 // Backroom SATNET Monitoring ProtocolSUNND = 77 // SUN ND PROTOCOL-Temporary ProtocolWBMON = 78 // WIDEBAND Monitoring ProtocolWBEXPAK = 79 // WIDEBAND EXPAK ProtocolISOIP = 80 // ISO Internet Protocol ProtocolVMTP = 81 // VMTP ProtocolSECUREVMTP = 82 // SECURE-VMTP ProtocolVINES = 83 // VINES ProtocolTTP = 84 // Transaction Transport Protocol ProtocolIPTM = 84 // Internet Protocol Traffic Manager ProtocolNSFNETIGP = 85 // NSFNET-IGP ProtocolDGP = 86 // Dissimilar Gateway Protocol ProtocolTCF = 87 // TCF ProtocolEIGRP = 88 // EIGRP ProtocolOSPFIGP = 89 // OSPFIGP ProtocolSpriteRPC = 90 // Sprite RPC Protocol ProtocolLARP = 91 // Locus Address Resolution Protocol ProtocolMTP = 92 // Multicast Transport Protocol ProtocolAX25 = 93 // AX.25 Frames ProtocolIPIP = 94 // IP-within-IP Encapsulation Protocol ProtocolSCCSP = 96 // Semaphore Communications Sec. Pro. ProtocolETHERIP = 97 // Ethernet-within-IP Encapsulation ProtocolENCAP = 98 // Encapsulation Header ProtocolGMTP = 100 // GMTP ProtocolIFMP = 101 // Ipsilon Flow Management Protocol ProtocolPNNI = 102 // PNNI over IP ProtocolPIM = 103 // Protocol Independent Multicast ProtocolARIS = 104 // ARIS ProtocolSCPS = 105 // SCPS ProtocolQNX = 106 // QNX ProtocolAN = 107 // Active Networks ProtocolIPComp = 108 // IP Payload Compression Protocol ProtocolSNP = 109 // Sitara Networks Protocol ProtocolCompaqPeer = 110 // Compaq Peer Protocol ProtocolIPXinIP = 111 // IPX in IP ProtocolVRRP = 112 // Virtual Router Redundancy Protocol ProtocolPGM = 113 // PGM Reliable Transport Protocol ProtocolL2TP = 115 // Layer Two Tunneling Protocol ProtocolDDX = 116 // D-II Data Exchange (DDX) ProtocolIATP = 117 // Interactive Agent Transfer Protocol ProtocolSTP = 118 // Schedule Transfer Protocol ProtocolSRP = 119 // SpectraLink Radio Protocol ProtocolUTI = 120 // UTI ProtocolSMP = 121 // Simple Message Protocol ProtocolPTP = 123 // Performance Transparency Protocol ProtocolISIS = 124 // ISIS over IPv4 ProtocolFIRE = 125 // FIRE ProtocolCRTP = 126 // Combat Radio Transport Protocol ProtocolCRUDP = 127 // Combat Radio User Datagram ProtocolSSCOPMCE = 128 // SSCOPMCE ProtocolIPLT = 129 // IPLT ProtocolSPS = 130 // Secure Packet Shield ProtocolPIPE = 131 // Private IP Encapsulation within IP ProtocolSCTP = 132 // Stream Control Transmission Protocol ProtocolFC = 133 // Fibre Channel ProtocolRSVPE2EIGNORE = 134 // RSVP-E2E-IGNORE ProtocolMobilityHeader = 135 // Mobility Header ProtocolUDPLite = 136 // UDPLite ProtocolMPLSinIP = 137 // MPLS-in-IP ProtocolMANET = 138 // MANET Protocols ProtocolHIP = 139 // Host Identity Protocol ProtocolShim6 = 140 // Shim6 Protocol ProtocolWESP = 141 // Wrapped Encapsulating Security Payload ProtocolROHC = 142 // Robust Header Compression ProtocolReserved = 255 // Reserved )
Protocol Numbers, Updated: 2017-10-13
const Comment = "a3ViZS12aXAK=kube-vip"
const MangleChainName = "KUBE-VIP-EGRESS"
Variables ¶
This section is empty.
Functions ¶
func ARPSendGratuitous ¶
ARPSendGratuitous sends a gratuitous ARP message via the specified interface.
func DeleteExistingSessions ¶ added in v0.5.7
func GarbageCollect ¶ added in v0.6.4
func GenerateMac ¶ added in v0.5.5
func GenerateMac() (mac string)
func GetDefaultGatewayInterface ¶ added in v0.4.0
GetDefaultGatewayInterface return default gateway interface link
func GetFullMask ¶
GetFullMask returns /32 for an IPv4 address and /128 for an IPv6 address
func ListRoutes ¶ added in v0.7.1
ListRoutes returns all routes from selected table with selected protocol
func ListRoutesByDst ¶ added in v0.7.1
ListRoutesByDst returns all routes from selected table with selected destination IP
func LookupHost ¶ added in v0.7.0
LookupHost resolves dnsName and return an IP or an error
Types ¶
type DDNSManager ¶
DDNSManager will start a dhclient to retrieve and keep the lease for the IP for the dDNSHostName will return the IP allocated
func NewDDNSManager ¶
func NewDDNSManager(ctx context.Context, network Network) DDNSManager
NewDDNSManager returns a newly created Dynamic DNS manager
type DHCPClient ¶
type DHCPClient struct {
// contains filtered or unexported fields
}
DHCPClient is responsible for maintaining ipv4 lease for one specified interface
func NewDHCPClient ¶
func NewDHCPClient(iface *net.Interface, initRebootFlag bool, requestedIP string) *DHCPClient
NewDHCPClient returns a new DHCP Client.
func (*DHCPClient) ErrorChannel ¶ added in v0.6.1
func (c *DHCPClient) ErrorChannel() chan error
Gets the ErrorChannel for consumption
func (*DHCPClient) IPChannel ¶ added in v0.6.1
func (c *DHCPClient) IPChannel() chan string
Gets the IPChannel for consumption
func (*DHCPClient) Start ¶
func (c *DHCPClient) Start()
Start state-transition process of dhcp client
-------- -------
| | +-------------------------->| |<-------------------+ | INIT- | | +-------------------->| INIT | | | REBOOT |DHCPNAK/ +---------->| |<---+ | | |Restart| | ------- | |
-------- | DHCPNAK/ | | | | Discard offer | -/Send DHCPDISCOVER |
-/Send DHCPREQUEST | | |
| | | DHCPACK v | | ----------- | (not accept.)/ ----------- | |
| | | Send DHCPDECLINE | | | | REBOOTING | | | | SELECTING |<----+ | | | | / | | |DHCPOFFER/ |
----------- | / ----------- | |Collect | | | / | | | replies |
DHCPACK/ | / +----------------+ +-------+ | Record lease, set| | v Select offer/ | timers T1, T2 ------------ send DHCPREQUEST | |
| +----->| | DHCPNAK, Lease expired/ | | | | REQUESTING | Halt network | DHCPOFFER/ | | | | Discard ------------ | | | | | | ----------- | | +--------+ DHCPACK/ | | | | Record lease, set -----| REBINDING | | | timers T1, T2 / | | | | | DHCPACK/ ----------- | | v Record lease, set ^ | +----------------> ------- /timers T1,T2 | | +----->| |<---+ | | | | BOUND |<---+ | | DHCPOFFER, DHCPACK, | | | T2 expires/ DHCPNAK/ DHCPNAK/Discard ------- | Broadcast Halt network | | | | DHCPREQUEST | +-------+ | DHCPACK/ | | T1 expires/ Record lease, set | | Send DHCPREQUEST timers T1, T2 | | to leasing server | | | | ---------- | | | | |------------+ | +->| RENEWING | | | |----------------------------+ ---------- Figure: State-transition diagram for DHCP clients
func (*DHCPClient) Stop ¶
func (c *DHCPClient) Stop()
Stop state-transition process and close dhcp client
func (*DHCPClient) WithHostName ¶ added in v0.4.1
func (c *DHCPClient) WithHostName(hostname string) *DHCPClient
type Egress ¶ added in v0.5.5
type Egress struct {
// contains filtered or unexported fields
}
func CreateIptablesClient ¶ added in v0.5.5
func (*Egress) AppendReturnRulesForDestinationSubnet ¶ added in v0.5.5
func (*Egress) AppendReturnRulesForMarking ¶ added in v0.5.5
func (*Egress) CheckMangleChain ¶ added in v0.5.5
func (*Egress) CleanIPtables ¶ added in v0.5.6
func (*Egress) CreateMangleChain ¶ added in v0.5.5
func (*Egress) DeleteMangleChain ¶ added in v0.5.5
func (*Egress) DeleteMangleMarking ¶ added in v0.5.6
func (*Egress) DeleteManglePrerouting ¶ added in v0.5.5
func (*Egress) DeleteSourceNat ¶ added in v0.5.5
func (*Egress) DeleteSourceNatForDestinationPort ¶ added in v0.5.5
func (*Egress) InsertMangeTableIntoPrerouting ¶ added in v0.5.5
func (*Egress) InsertSourceNat ¶ added in v0.5.5
func (*Egress) InsertSourceNatForDestinationPort ¶ added in v0.5.5
type NdpResponder ¶
type NdpResponder struct {
// contains filtered or unexported fields
}
NdpResponder defines the parameters for the NDP connection.
func NewNDPResponder ¶
func NewNDPResponder(ifaceName string) (*NdpResponder, error)
NewNDPResponder takes an ifaceName and returns a new NDP responder and error if encountered.
func (*NdpResponder) Close ¶
func (n *NdpResponder) Close() error
Close closes the NDP responder connection.
func (*NdpResponder) SendGratuitous ¶
func (n *NdpResponder) SendGratuitous(address string) error
SendGratuitous broadcasts an NDP update or returns error if encountered.
type Network ¶
type Network interface { AddIP() error AddRoute() error DeleteIP() error DeleteRoute() error UpdateRoutes() (bool, error) IsSet() (bool, error) IP() string PrepareRoute() *netlink.Route SetIP(ip string) error SetServicePorts(service *v1.Service) Interface() string IsDADFAIL() bool IsDNS() bool IsDDNS() bool DDNSHostName() string DNSName() string }
Network is an interface that enable managing operations for a given IP