Documentation ¶
Index ¶
- Variables
- 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 Update(obj *Switch)
- func VarDir(name ...string) string
- type ACL
- type ACLRule
- type Bridge
- type Cert
- type Crypt
- type Dhcp
- type FindHop
- type FlowRule
- type HostLease
- type Http
- type HttpForward
- type HttpProxy
- type IPSecSpecifies
- type IPSecTunnel
- type Interface
- type LDAP
- type Linker
- type Log
- type MultiPath
- type Network
- func (n *Network) AddFindHop(value *FindHop) bool
- func (n *Network) AddOutput(value *Output) bool
- func (n *Network) AddRoute(value PrefixRoute) bool
- func (n *Network) Correct(sw *Switch)
- func (n *Network) DelFindHop(value *FindHop) (*FindHop, bool)
- func (n *Network) DelOutput(value *Output) (*Output, bool)
- func (n *Network) DelRoute(value PrefixRoute) (PrefixRoute, bool)
- func (n *Network) Dir(elem ...string) string
- func (n *Network) FindFindHop(value *FindHop) *FindHop
- func (n *Network) FindOutput(value *Output) (*Output, int)
- func (n *Network) FindRoute(value PrefixRoute) (PrefixRoute, int)
- func (n *Network) ListRoute(call func(value PrefixRoute))
- func (n *Network) LoadFindHop()
- func (n *Network) LoadLink()
- func (n *Network) LoadOutput()
- func (n *Network) LoadRoute()
- func (n *Network) NewSpecifies() interface{}
- func (n *Network) Reload()
- func (n *Network) Save()
- func (n *Network) SaveFindHop()
- func (n *Network) SaveLink()
- func (n *Network) SaveOutput()
- func (n *Network) SaveRoute()
- type OpenVPN
- type OpenVPNClient
- type Output
- type Password
- type Perf
- type PingParams
- type Point
- type PrefixRoute
- type Proxy
- type Qos
- type QosLimit
- type Queue
- type RouterSpecifies
- type ShadowProxy
- type SocksProxy
- type Subnet
- type Switch
- func (s *Switch) AddNetwork(data []byte) (*Network, error)
- func (s *Switch) Correct()
- func (s *Switch) CorrectNetwork(obj *Network)
- func (s *Switch) CorrectNetworks()
- func (s *Switch) Dir(elem ...string) string
- func (s *Switch) FormatNetworks()
- func (s *Switch) GetACL(name string) *ACL
- func (s *Switch) GetNetwork(name string) *Network
- func (s *Switch) GetQos(name string) *Qos
- func (s *Switch) Initialize()
- func (s *Switch) Load() error
- func (s *Switch) LoadAcl()
- func (s *Switch) LoadExt()
- func (s *Switch) LoadNetworkJson(data []byte) (*Network, error)
- func (s *Switch) LoadNetworks()
- func (s *Switch) LoadQos()
- func (s *Switch) Parse()
- func (s *Switch) Reload()
- func (s *Switch) Save()
- func (s *Switch) SaveAcl()
- func (s *Switch) SaveNetwork()
- func (s *Switch) SaveQos()
- type TcpProxy
- type VxLANSpecifies
Constants ¶
This section is empty.
Variables ¶
View Source
var ( QdSwr = 32 * 4 QdSrd = 32 * 4 QdTwr = 32 * 2 QdTrd = 2 QdVsd = 32 * 8 QdVWr = 32 * 4 )
Functions ¶
func CorrectAddr ¶
func CorrectRoutes ¶
func CorrectRoutes(routes []PrefixRoute, nexthop string)
Types ¶
type ACL ¶
type ACLRule ¶
type Bridge ¶
type Bridge struct { Network string `json:"-" yaml:"-"` Peer string `json:"peer,omitempty"` Name string `json:"name,omitempty"` IPMtu int `json:"mtu,omitempty"` Address string `json:"address,omitempty"` Provider string `json:"-" yaml:"-"` 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"` Interface string `json:"interface,omitempty"` Subnet *Subnet `json:"subnet,omitempty"` Hosts []HostLease `json:"hosts,omitempty"` Routes []PrefixRoute `json:"routes,omitempty"` }
type FindHop ¶
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 Http ¶
type HttpForward ¶
type HttpProxy ¶
type HttpProxy struct { ConfDir string `json:"-" yaml:"-"` Listen string `json:"listen,omitempty"` Auth *Password `json:"auth,omitempty" yaml:"auth,omitempty"` Cert *Cert `json:"cert,omitempty" yaml:"cert,omitempty"` Password string `json:"password,omitempty" yaml:"password,omitempty"` Forward *HttpForward `json:"forward,omitempty" yaml:"forward,omitempty"` Backends []*HttpForward `json:"backends,omitempty" yaml:"backend,omitempty"` }
func (*HttpProxy) FindBackend ¶
func (h *HttpProxy) FindBackend(remote string) *HttpForward
type IPSecSpecifies ¶
type IPSecSpecifies struct { Name string `json:"name"` Tunnels []*IPSecTunnel `json:"tunnels"` }
func (*IPSecSpecifies) AddTunnel ¶
func (s *IPSecSpecifies) AddTunnel(value *IPSecTunnel) bool
func (*IPSecSpecifies) Correct ¶
func (s *IPSecSpecifies) Correct()
func (*IPSecSpecifies) DelTunnel ¶
func (s *IPSecSpecifies) DelTunnel(value *IPSecTunnel) (*IPSecTunnel, bool)
func (*IPSecSpecifies) FindTunnel ¶
func (s *IPSecSpecifies) FindTunnel(value *IPSecTunnel) (*IPSecTunnel, int)
type IPSecTunnel ¶
type IPSecTunnel struct { Name string `json:"-"` Left string `json:"local"` LeftId string `json:"localid,omitempty"` LeftPort int `json:"localport,omitempty"` Right string `json:"remote"` RightId string `json:"remoteid,omitempty"` RightPort int `json:"remoteport,omitempty"` Transport string `json:"protocol"` Secret string `json:"secret"` State string `json:"state"` }
func (*IPSecTunnel) Correct ¶
func (s *IPSecTunnel) Correct()
func (*IPSecTunnel) Id ¶
func (s *IPSecTunnel) Id() string
type Interface ¶
type MultiPath ¶
func (*MultiPath) CompareEqual ¶
type Network ¶
type Network struct { ConfDir string `json:"-"` File string `json:"-"` 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,omitempty"` ZTrust string `json:"ztrust,omitempty"` Qos string `json:"qos,omitempty"` Snat string `json:"snat,omitempty"` Namespace string `json:"namespace,omitempty"` FindHop map[string]*FindHop `json:"findhop,omitempty"` }
func GetNetwork ¶
func (*Network) AddFindHop ¶
func (*Network) AddRoute ¶
func (n *Network) AddRoute(value PrefixRoute) bool
func (*Network) DelRoute ¶
func (n *Network) DelRoute(value PrefixRoute) (PrefixRoute, bool)
func (*Network) FindFindHop ¶
func (*Network) FindRoute ¶
func (n *Network) FindRoute(value PrefixRoute) (PrefixRoute, int)
func (*Network) ListRoute ¶
func (n *Network) ListRoute(call func(value PrefixRoute))
func (*Network) LoadFindHop ¶
func (n *Network) LoadFindHop()
func (*Network) LoadOutput ¶
func (n *Network) LoadOutput()
func (*Network) NewSpecifies ¶
func (n *Network) NewSpecifies() interface{}
func (*Network) SaveFindHop ¶
func (n *Network) SaveFindHop()
func (*Network) SaveOutput ¶
func (n *Network) SaveOutput()
type OpenVPN ¶
type OpenVPN struct { Network string `json:"network"` Url string `json:"url,omitempty"` Directory string `json:"directory,omitempty"` 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,omitempty"` RootCa string `json:"rootCa,omitempty"` ServerCrt string `json:"cert,omitempty"` ServerKey string `json:"key,omitempty"` TlsAuth string `json:"tlsAuth,omitempty"` Cipher string `json:"cipher,omitempty"` 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
func (*OpenVPN) AddRedirectDef1 ¶
func (*OpenVPN) DelRedirectDef1 ¶
type OpenVPNClient ¶
type Output ¶
type Output struct { Segment int `json:"segment"` Protocol string `json:"protocol,omitempty"` // gre, vxlan, tcp/tls/wss etc. Remote string `json:"remote"` DstPort int `json:"dstport,omitempty"` Link string `json:"link,omitempty"` // link name Secret string `json:"secret,omitempty"` Crypt string `json:"crypt,omitempty"` Linker Linker `json:"-"` }
type Perf ¶
type PingParams ¶
type PingParams struct { Count int `json:"count"` Loss int `json:"loss,omitempty"` Rtt int `json:"rtt,omitempty"` Interval int `json:"interval,omitempty"` }
func (*PingParams) Correct ¶
func (pp *PingParams) Correct()
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"` 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"` FindHop string `json:"findhop,omitempty"` }
func (*PrefixRoute) CorrectRoute ¶
func (r *PrefixRoute) CorrectRoute(nexthop string)
func (*PrefixRoute) String ¶
func (r *PrefixRoute) String() string
type Proxy ¶
type Proxy struct { Conf string `json:"-" yaml:"-"` ConfDir string `json:"-" yaml:"-"` Log Log `json:"log"` Socks []*SocksProxy `json:"socks,omitempty" yaml:"socks,omitempty"` Http []*HttpProxy `json:"http,omitempty" yaml:"http,omitempty"` Tcp []*TcpProxy `json:"tcp,omitempty" yaml:"tcp,omitempty"` Shadow []*ShadowProxy `json:"shadow,omitempty" yaml:"shadow,omitempty"` PProf string `json:"pprof,omitempty" yaml:"pprof,omitempty"` }
func (*Proxy) Initialize ¶
func (p *Proxy) Initialize()
type Qos ¶
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,omitempty"` Loopback string `json:"loopback,omitempty"` }
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:"-"` 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 map[string]*Network `json:"network,omitempty"` Acl map[string]*ACL `json:"acl,omitempty"` Qos map[string]*Qos `json:"qos,omitempty"` FireWall []FlowRule `json:"firewall,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:"-"` }
func (*Switch) CorrectNetwork ¶
func (*Switch) CorrectNetworks ¶
func (s *Switch) CorrectNetworks()
func (*Switch) FormatNetworks ¶
func (s *Switch) FormatNetworks()
func (*Switch) GetNetwork ¶
func (*Switch) Initialize ¶
func (s *Switch) Initialize()
func (*Switch) LoadNetworks ¶
func (s *Switch) LoadNetworks()
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.