Documentation ¶
Index ¶
- Variables
- func Addr2Cidr(addr string) string
- func CorrectAddr(listen *string, port int)
- func CorrectRoutes(routes []PrefixRoute, nexthop string)
- func GenName(prefix string) string
- func GetAlias() string
- func LogFile(file string) string
- func Reload()
- func SetLocalUdp(port string)
- func VarDir(name ...string) string
- type ACL
- type ACLRule
- type Bridge
- type Cert
- type Crypt
- type Dhcp
- type EspMember
- type EspPolicy
- type EspSpecifies
- type EspState
- type FabricSpecifies
- type FabricTunnel
- type FlowRule
- type HostLease
- type Http
- type HttpProxy
- type Interface
- type L2TP
- type LDAP
- type Log
- type MultiPath
- type Network
- type OpenVPN
- type OpenVPNClient
- type Output
- type Password
- type Perf
- type Point
- type PrefixRoute
- type Proxy
- type Queue
- type RouterSpecifies
- type ShadowProxy
- type SocksProxy
- type Subnet
- type Switch
- func (s *Switch) Correct()
- func (s *Switch) Dir(elem ...string) string
- func (s *Switch) Format()
- func (s *Switch) GetNetwork(name string) *Network
- func (s *Switch) Initialize()
- func (s *Switch) Load() error
- func (s *Switch) LoadAcl()
- func (s *Switch) LoadExt()
- func (s *Switch) LoadNetwork()
- func (s *Switch) Parse()
- func (s *Switch) Reload()
- func (s *Switch) Save()
- func (s *Switch) SaveAcl()
- func (s *Switch) SaveNetwork()
- type TcpProxy
- type VxLANSpecifies
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EspAuth = "8bc736635c0642aebc20ba5420c3e93a" EspCrypt = "4ac161f6635843b8b02c60cc36822515" EspLocalUdp = 4500 EspRemoteUdp = 4500 )
View Source
var ( QdSwr = 32 * 4 QdSrd = 32 * 4 QdTwr = 32 * 2 QdTrd = 2 QdVsd = 32 * 8 QdVWr = 32 * 4 )
View Source
var Manager = manager{ Switch: &Switch{}, }
Functions ¶
func CorrectAddr ¶
func CorrectRoutes ¶
func CorrectRoutes(routes []PrefixRoute, nexthop string)
func SetLocalUdp ¶
func SetLocalUdp(port string)
Types ¶
type ACLRule ¶
type ACLRule struct { Name string `json:"name,omitempty"` SrcIp string `json:"source,omitempty"` DstIp string `json:"destination,omitempty"` Proto string `json:"protocol,omitempty"` SrcPort string `json:"sourcePort,omitempty"` DstPort string `json:"destPort,omitempty"` Action string `json:"action,omitempty"` }
type Bridge ¶
type Bridge struct { Network string `json:"network"` Peer string `json:"peer,omitempty"` Name string `json:"name,omitempty"` IPMtu int `json:"mtu,omitempty"` Address string `json:"address,omitempty"` Provider string `json:"provider,omitempty"` Stp string `json:"stp,omitempty"` Delay int `json:"delay,omitempty"` Mss int `json:"tcpMss,omitempty"` }
type Cert ¶
type Cert struct { Dir string `json:"directory"` CrtFile string `json:"cert"` KeyFile string `json:"key"` CaFile string `json:"rootCa"` Insecure bool `json:"insecure"` }
func (*Cert) GetCertPool ¶
type Crypt ¶
type Dhcp ¶
type Dhcp struct { Name string `json:"name,omitempty"` Bridge *Bridge `json:"bridge,omitempty"` Subnet *Subnet `json:"subnet,omitempty"` Hosts []HostLease `json:"hosts,omitempty"` Routes []PrefixRoute `json:"routes,omitempty"` }
type EspMember ¶
type EspMember struct { Name string `json:"name,omitempty"` Address string `json:"address,omitempty"` Peer string `json:"peer"` Spi int `json:"spi"` State EspState `json:"state"` Policies []*EspPolicy `json:"policies"` }
func (*EspMember) RemovePolicy ¶
type EspPolicy ¶
type EspSpecifies ¶
type EspSpecifies struct { Name string `json:"name"` Address string `json:"address,omitempty"` State EspState `json:"state,omitempty"` Members []*EspMember `json:"members"` Listen string `json:"listen,omitempty"` TcpMss int `json:"tcpMss"` }
func (*EspSpecifies) AddMember ¶
func (n *EspSpecifies) AddMember(obj *EspMember)
func (*EspSpecifies) Correct ¶
func (n *EspSpecifies) Correct()
func (*EspSpecifies) DelMember ¶
func (n *EspSpecifies) DelMember(name string) bool
func (*EspSpecifies) GetMember ¶
func (n *EspSpecifies) GetMember(name string) *EspMember
func (*EspSpecifies) HasRemote ¶
func (n *EspSpecifies) HasRemote(name, addr string) bool
type EspState ¶
type EspState struct { Local string `json:"local,omitempty"` LocalIp net.IP `json:"localAddr,omitempty"` Remote string `json:"remote,omitempty"` RemotePort int `json:"remotePort,omitempty"` RemoteIp net.IP `json:"remoteAddr,omitempty"` Encap string `json:"encapsulation,omitempty"` Auth string `json:"auth,omitempty"` Crypt string `json:"crypt,omitempty"` }
type FabricSpecifies ¶
type FabricSpecifies struct { Mss int `json:"tcpMss,omitempty"` Fragment bool `json:"fragment"` Driver string `json:"driver,omitempty"` Name string `json:"name,omitempty"` Tunnels []*FabricTunnel `json:"tunnels"` }
func (*FabricSpecifies) AddTunnel ¶
func (n *FabricSpecifies) AddTunnel(obj *FabricTunnel)
func (*FabricSpecifies) Correct ¶
func (n *FabricSpecifies) Correct()
func (*FabricSpecifies) DelTunnel ¶
func (n *FabricSpecifies) DelTunnel(remote string) bool
type FabricTunnel ¶
type FabricTunnel struct { DstPort uint32 `json:"destPort"` Remote string `json:"remote"` Local string `json:"local,omitempty"` Mode string `json:"mode,omitempty"` }
func (*FabricTunnel) Correct ¶
func (c *FabricTunnel) Correct()
type FlowRule ¶
type FlowRule struct { Table string `json:"table,omitempty"` Chain string `json:"chain,omitempty"` Input string `json:"input,omitempty"` Source string `json:"source,omitempty"` ToSource string `json:"toSource,omitempty"` Dest string `json:"destination,omitempty"` ToDest string `json:"toDestination"` Output string `json:"output,omitempty"` Comment string `json:"comment,omitempty"` Proto string `json:"protocol,omitempty"` Match string `json:"match,omitempty"` DstPort string `json:"destPort,omitempty"` SrcPort string `json:"sourcePort,omitempty"` CtState string `json:"ctState,omitempty"` Jump string `json:"jump,omitempty"` // SNAT/RETURN/MASQUERADE }
type Interface ¶
type Network ¶
type Network struct { ConfDir string `json:"-"` File string `json:"file"` Alias string `json:"-"` Name string `json:"name"` Provider string `json:"provider,omitempty"` Bridge *Bridge `json:"bridge,omitempty"` Subnet *Subnet `json:"subnet,omitempty"` OpenVPN *OpenVPN `json:"openvpn,omitempty"` Links []Point `json:"links,omitempty"` Hosts []HostLease `json:"hosts,omitempty"` Routes []PrefixRoute `json:"routes,omitempty"` Acl string `json:"acl,omitempty"` Specifies interface{} `json:"specifies,omitempty"` Dhcp string `json:"dhcp,omitempty"` Outputs []Output `json:"outputs"` }
func (*Network) NewSpecifies ¶
func (n *Network) NewSpecifies() interface{}
type OpenVPN ¶
type OpenVPN struct { Network string `json:"network"` Directory string `json:"directory"` Listen string `json:"listen"` Protocol string `json:"protocol,omitempty"` Subnet string `json:"subnet"` Device string `json:"device"` Version int `json:"version,omitempty"` Auth string `json:"auth,omitempty"` // xauth or cert. DhPem string `json:"dhPem"` RootCa string `json:"rootCa"` ServerCrt string `json:"cert"` ServerKey string `json:"key"` TlsAuth string `json:"tlsAuth"` Cipher string `json:"cipher"` Routes []string `json:"-"` Renego int `json:"renego,omitempty"` Script string `json:"-"` Push []string `json:"push,omitempty"` Clients []*OpenVPNClient `json:"clients,omitempty"` }
func DefaultOpenVPN ¶
func DefaultOpenVPN() *OpenVPN
type OpenVPNClient ¶
type Perf ¶
type Point ¶
type Point struct { File string `json:"file,omitempty"` Alias string `json:"alias,omitempty"` Connection string `json:"connection"` Timeout int `json:"timeout,omitempty"` Username string `json:"username,omitempty"` Network string `json:"network,omitempty"` Password string `json:"password,omitempty"` Protocol string `json:"protocol,omitempty"` Interface Interface `json:"interface,omitempty"` Log Log `json:"log,omitempty"` Http *Http `json:"http,omitempty"` Crypt *Crypt `json:"crypt,omitempty"` PProf string `json:"pprof,omitempty"` RequestAddr bool `json:"requestAddr,omitempty"` ByPass bool `json:"bypass,omitempty"` SaveFile string `json:"-"` Queue *Queue `json:"queue,omitempty"` Terminal string `json:"-"` Cert *Cert `json:"cert,omitempty"` StatusFile string `json:"status,omitempty"` PidFile string `json:"pid,omitempty"` }
func (*Point) Initialize ¶
func (ap *Point) Initialize()
type PrefixRoute ¶
type PrefixRoute struct { File string `json:"-"` Network string `json:"network,omitempty"` Prefix string `json:"prefix"` NextHop string `json:"nexthop"` MultiPath []MultiPath `json:"multipath,omitempty"` Metric int `json:"metric"` Mode string `json:"forward,omitempty"` // route or snat }
func (*PrefixRoute) String ¶
func (r *PrefixRoute) String() string
type Proxy ¶
type Proxy struct { Conf string `json:"-"` Log Log `json:"log"` Socks []*SocksProxy `json:"socks,omitempty"` Http []*HttpProxy `json:"http,omitempty"` Tcp []*TcpProxy `json:"tcp,omitempty"` Shadow []*ShadowProxy `json:"shadow,omitempty"` PProf string `json:"pprof"` }
func (*Proxy) Initialize ¶
func (p *Proxy) Initialize()
type Queue ¶
type Queue struct { SockWr int `json:"sockWr"` // per frames about 1572(1514+4+20+20+14)bytes SockRd int `json:"sockRd"` // per frames TapWr int `json:"tapWr"` // per frames about 1572((1514+4+20+20+14))bytes TapRd int `json:"tapRd"` // per frames VirSnd int `json:"virSnd"` VirWrt int `json:"virWrt"` }
type RouterSpecifies ¶
type RouterSpecifies struct { Mss int `json:"tcpMss,omitempty"` Name string `json:"name,omitempty"` Link string `json:"link,omitempty"` Subnets []Subnet `json:"subnets"` }
func (*RouterSpecifies) Correct ¶
func (n *RouterSpecifies) Correct()
type ShadowProxy ¶
type ShadowProxy struct { Server string `json:"server,omitempty"` Key string `json:"key,omitempty"` Cipher string `json:"cipher,omitempty"` Password string `json:"password,omitempty"` Plugin string `json:"plugin,omitempty"` PluginOpts string `json:"pluginOpts,omitempty"` Protocol string `json:"protocol,omitempty"` }
type SocksProxy ¶
type Switch ¶
type Switch struct { File string `json:"file"` Alias string `json:"alias"` Perf Perf `json:"limit,omitempty"` Protocol string `json:"protocol"` // tcp, tls, udp, kcp, ws and wss. Listen string `json:"listen"` Timeout int `json:"timeout"` Http *Http `json:"http,omitempty"` Log Log `json:"log"` Cert *Cert `json:"cert,omitempty"` Crypt *Crypt `json:"crypt,omitempty"` Network []*Network `json:"network,omitempty"` Acl []*ACL `json:"acl,omitempty"` FireWall []FlowRule `json:"firewall,omitempty"` Inspect []string `json:"inspect,omitempty"` Queue Queue `json:"queue"` PassFile string `json:"password"` Ldap *LDAP `json:"ldap,omitempty"` AddrPool string `json:"pool,omitempty"` ConfDir string `json:"-"` TokenFile string `json:"-"` L2TP *L2TP `json:"l2tp"` }
func (*Switch) GetNetwork ¶
func (*Switch) Initialize ¶
func (s *Switch) Initialize()
func (*Switch) LoadNetwork ¶
func (s *Switch) LoadNetwork()
func (*Switch) SaveNetwork ¶
func (s *Switch) SaveNetwork()
type VxLANSpecifies ¶
type VxLANSpecifies struct { Name string `json:"name,omitempty"` Vni uint32 `json:"vni"` Fabric string `json:"fabric"` }
func (*VxLANSpecifies) Correct ¶
func (c *VxLANSpecifies) Correct()
Click to show internal directories.
Click to hide internal directories.