nettool

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const BGPPort = "179"

Variables

View Source
var AgentTable int
View Source
var IPTablesRunner iptables.Interface

Functions

func AddPortForwardOfBGP

func AddPortForwardOfBGP(routerIP, localIP string, gobgpPort int32) error

Example: iptables -t nat -A PREROUTING -s 10.10.12.1 -p tcp --dport 179 -j DNAT --to-destination 10.10.12.1:17900

func DeletePortForwardOfBGP

func DeletePortForwardOfBGP(routerIP, localIP string, gobgpPort int32) error

func GenerateCretiriaAndAction

func GenerateCretiriaAndAction(routerIP, localIP string, gobgpPort int32) []string

Types

type EIPRoute

type EIPRoute struct {
}

EIPRoute is a specified ip route which our agent use on start. Equivalent to: "ip route replace local 0/0 dev lo table"

func (*EIPRoute) Add

func (e *EIPRoute) Add() error

func (*EIPRoute) Delete

func (e *EIPRoute) Delete() error

func (*EIPRoute) IsExist

func (e *EIPRoute) IsExist() (bool, error)

func (*EIPRoute) ToNetlinkRoute

func (e *EIPRoute) ToNetlinkRoute() *netlink.Route

Equivalent to: "ip route replace local 0/0 dev lo table"

type EIPRule

type EIPRule struct {
	EIP *net.IPNet
}

EIPRule is a specified ip rule which our agent will use. Equivalent to: "ip rule from all to eip/32 lookup 101"

func NewEIPRule

func NewEIPRule(eip string, mask int) *EIPRule

func (*EIPRule) Add

func (e *EIPRule) Add() error

func (*EIPRule) Delete

func (e *EIPRule) Delete() error

func (*EIPRule) IsExist

func (e *EIPRule) IsExist() (bool, error)

func (*EIPRule) ToAgentRule

func (e *EIPRule) ToAgentRule() *netlink.Rule

Jump to

Keyboard shortcuts

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