Documentation ¶
Index ¶
- Constants
- Variables
- func IptableInit()
- func WaterNew(c TapConfig) (*water.Interface, error)
- type BrCtl
- type BrPort
- type Bridger
- type DeviceStats
- type FireWallChain
- type FireWallFilter
- type FireWallGlobal
- func (f *FireWallGlobal) AddChain(chain IpChain)
- func (f *FireWallGlobal) AddRule(rule IpRule)
- func (f *FireWallGlobal) CancelRule(rule IpRule) error
- func (f *FireWallGlobal) Initialize()
- func (f *FireWallGlobal) InstallRule(rule IpRule) error
- func (f *FireWallGlobal) Refresh()
- func (f *FireWallGlobal) Start()
- func (f *FireWallGlobal) Stop()
- type FireWallJump
- type FireWallMangle
- type FireWallNAT
- type FireWallNATPre
- type FireWallRaw
- type FireWallTable
- type Framer
- type IPSet
- type IpChain
- type IpChains
- type IpRule
- type IpRules
- type KernelTap
- func (t *KernelTap) Close() error
- func (t *KernelTap) Down()
- func (t *KernelTap) Has(v uint) bool
- func (t *KernelTap) IsTun() bool
- func (t *KernelTap) Master() Bridger
- func (t *KernelTap) Mtu() int
- func (t *KernelTap) Name() string
- func (t *KernelTap) Read(p []byte) (int, error)
- func (t *KernelTap) Recv(p []byte) (int, error)
- func (t *KernelTap) Send(p []byte) (int, error)
- func (t *KernelTap) SetMaster(dev Bridger) error
- func (t *KernelTap) String() string
- func (t *KernelTap) Tenant() string
- func (t *KernelTap) Type() string
- func (t *KernelTap) Up()
- func (t *KernelTap) Write(p []byte) (int, error)
- type LinuxBridge
- func (b *LinuxBridge) AddSlave(name string) error
- func (b *LinuxBridge) CallIptables(value int) error
- func (b *LinuxBridge) Close() error
- func (b *LinuxBridge) DelSlave(name string) error
- func (b *LinuxBridge) Delay(value int) error
- func (b *LinuxBridge) Kernel() string
- func (b *LinuxBridge) ListMac() <-chan *MacFdb
- func (b *LinuxBridge) ListSlave() <-chan Taper
- func (b *LinuxBridge) Mtu() int
- func (b *LinuxBridge) Name() string
- func (b *LinuxBridge) Open(addr string)
- func (b *LinuxBridge) Stats() DeviceStats
- func (b *LinuxBridge) Stp(enable bool) error
- func (b *LinuxBridge) String() string
- func (b *LinuxBridge) Type() string
- type MacFdb
- type TapConfig
- type Taper
- type VirtualBridge
- func (b *VirtualBridge) AddMac(mac string, fdb *MacFdb)
- func (b *VirtualBridge) AddSlave(name string) error
- func (b *VirtualBridge) CallIptables(value int) error
- func (b *VirtualBridge) Close() error
- func (b *VirtualBridge) DelSlave(name string) error
- func (b *VirtualBridge) Delay(value int) error
- func (b *VirtualBridge) Eth2Str(addr []byte) string
- func (b *VirtualBridge) Expire() error
- func (b *VirtualBridge) Flood(m *Framer) error
- func (b *VirtualBridge) Forward(m *Framer) error
- func (b *VirtualBridge) GetMac(mac string) *MacFdb
- func (b *VirtualBridge) Input(m *Framer) error
- func (b *VirtualBridge) Kernel() string
- func (b *VirtualBridge) Learn(m *Framer)
- func (b *VirtualBridge) ListMac() <-chan *MacFdb
- func (b *VirtualBridge) ListSlave() <-chan Taper
- func (b *VirtualBridge) Mtu() int
- func (b *VirtualBridge) Name() string
- func (b *VirtualBridge) Open(addr string)
- func (b *VirtualBridge) Start()
- func (b *VirtualBridge) Stats() DeviceStats
- func (b *VirtualBridge) Stp(enable bool) error
- func (b *VirtualBridge) String() string
- func (b *VirtualBridge) Type() string
- func (b *VirtualBridge) UniCast(m *Framer) error
- func (b *VirtualBridge) UpdateMac(mac string, device Taper)
- type VirtualTap
- func (t *VirtualTap) Close() error
- func (t *VirtualTap) Down()
- func (t *VirtualTap) Has(v uint) bool
- func (t *VirtualTap) IsTun() bool
- func (t *VirtualTap) Master() Bridger
- func (t *VirtualTap) Mtu() int
- func (t *VirtualTap) Name() string
- func (t *VirtualTap) Read(p []byte) (int, error)
- func (t *VirtualTap) Recv(p []byte) (int, error)
- func (t *VirtualTap) Send(p []byte) (int, error)
- func (t *VirtualTap) SetMaster(dev Bridger) error
- func (t *VirtualTap) String() string
- func (t *VirtualTap) Tenant() string
- func (t *VirtualTap) Type() string
- func (t *VirtualTap) Up()
- func (t *VirtualTap) Write(p []byte) (int, error)
Constants ¶
View Source
const ( ProviderVir = "virtual" ProviderKer = "kernel" ProviderLin = "linux" )
View Source
const ( OLCInput = "XTT_in" OLCForward = "XTT_for" OLCOutput = "XTT_out" OLCPre = "XTT_pre" OLCPost = "XTT_pos" )
View Source
const ( TNat = "nat" TRaw = "raw" TMangle = "mangle" TFilter = "filter" CInput = "INPUT" CForward = "FORWARD" COutput = "OUTPUT" CPost = "POSTROUTING" CPre = "PREROUTING" CMasq = "MASQUERADE" CNoTrk = "NOTRACK" CSnat = "SNAT" )
View Source
const ( UsClose = uint(0x02) UsUp = uint(0x04) TUN = 0x01 TAP = 0x02 )
Variables ¶
View Source
var Bridges = &bridger{}
View Source
var Taps = &tapers{}
Functions ¶
func IptableInit ¶
func IptableInit()
Types ¶
type BrCtl ¶
func (*BrCtl) CallIptables ¶
type Bridger ¶
type Bridger interface { Type() string Name() string Open(addr string) Close() error AddSlave(name string) error DelSlave(name string) error ListSlave() <-chan Taper Mtu() int Stp(enable bool) error Delay(value int) error Kernel() string // name in kernel. ListMac() <-chan *MacFdb String() string Stats() DeviceStats CallIptables(value int) error }
func NewBridger ¶
type DeviceStats ¶
type FireWallChain ¶
type FireWallChain struct {
// contains filtered or unexported fields
}
func NewFireWallChain ¶
func NewFireWallChain(name, table, parent string) *FireWallChain
func (*FireWallChain) AddRule ¶
func (ch *FireWallChain) AddRule(rule IpRule)
func (*FireWallChain) Cancel ¶
func (ch *FireWallChain) Cancel()
func (*FireWallChain) Chain ¶
func (ch *FireWallChain) Chain() IpChain
func (*FireWallChain) Install ¶
func (ch *FireWallChain) Install()
type FireWallFilter ¶
type FireWallFilter struct { In *FireWallChain Out *FireWallChain For *FireWallChain Jump *FireWallJump // contains filtered or unexported fields }
func NewFireWallFilter ¶
func NewFireWallFilter(name string) *FireWallFilter
func (*FireWallFilter) Cancel ¶
func (f *FireWallFilter) Cancel()
func (*FireWallFilter) Install ¶
func (f *FireWallFilter) Install()
type FireWallGlobal ¶
type FireWallGlobal struct {
// contains filtered or unexported fields
}
func NewFireWallGlobal ¶
func NewFireWallGlobal(flows []config.FlowRule) *FireWallGlobal
func (*FireWallGlobal) AddChain ¶
func (f *FireWallGlobal) AddChain(chain IpChain)
func (*FireWallGlobal) AddRule ¶
func (f *FireWallGlobal) AddRule(rule IpRule)
func (*FireWallGlobal) CancelRule ¶
func (f *FireWallGlobal) CancelRule(rule IpRule) error
func (*FireWallGlobal) Initialize ¶
func (f *FireWallGlobal) Initialize()
func (*FireWallGlobal) InstallRule ¶
func (f *FireWallGlobal) InstallRule(rule IpRule) error
func (*FireWallGlobal) Refresh ¶
func (f *FireWallGlobal) Refresh()
func (*FireWallGlobal) Start ¶
func (f *FireWallGlobal) Start()
func (*FireWallGlobal) Stop ¶
func (f *FireWallGlobal) Stop()
type FireWallJump ¶
type FireWallJump struct {
// contains filtered or unexported fields
}
func (*FireWallJump) Cancel ¶
func (j *FireWallJump) Cancel()
func (*FireWallJump) Install ¶
func (j *FireWallJump) Install(ch IpChain)
type FireWallMangle ¶
type FireWallMangle struct { Pre *FireWallChain In *FireWallChain For *FireWallChain Out *FireWallChain Post *FireWallChain Jump *FireWallJump // contains filtered or unexported fields }
func NewFireWallMangle ¶
func NewFireWallMangle(name string) *FireWallMangle
func (*FireWallMangle) Cancel ¶
func (m *FireWallMangle) Cancel()
func (*FireWallMangle) Install ¶
func (m *FireWallMangle) Install()
type FireWallNAT ¶
type FireWallNAT struct { Pre *FireWallChain In *FireWallChain Out *FireWallChain Post *FireWallChain Jump *FireWallJump // contains filtered or unexported fields }
func NewFireWallNAT ¶
func NewFireWallNAT(name string) *FireWallNAT
func (*FireWallNAT) Cancel ¶
func (n *FireWallNAT) Cancel()
func (*FireWallNAT) Install ¶
func (n *FireWallNAT) Install()
type FireWallNATPre ¶
type FireWallNATPre struct {
*FireWallChain
}
func (*FireWallNATPre) Chain ¶
func (ch *FireWallNATPre) Chain() IpChain
type FireWallRaw ¶
type FireWallRaw struct { Pre *FireWallChain Out *FireWallChain Jump *FireWallJump // contains filtered or unexported fields }
func NewFireWallRaw ¶
func NewFireWallRaw(name string) *FireWallRaw
func (*FireWallRaw) Cancel ¶
func (r *FireWallRaw) Cancel()
func (*FireWallRaw) Install ¶
func (r *FireWallRaw) Install()
type FireWallTable ¶
type FireWallTable struct { Filter *FireWallFilter Nat *FireWallNAT Mangle *FireWallMangle Raw *FireWallRaw }
func NewFireWallTable ¶
func NewFireWallTable(name string) *FireWallTable
func (*FireWallTable) Start ¶
func (t *FireWallTable) Start()
func (*FireWallTable) Stop ¶
func (t *FireWallTable) Stop()
type IpRule ¶
type IpRule struct { Table string Chain string Source string SrcSet string ToSource string NoSource string NoSrcSet string Dest string DestSet string ToDest string NoDest string NoDestSet string Proto string DstPort string SrcPort string Input string Output string Comment string Jump string SetMss int Order string Match string CtState string TcpFlag []string }
type LinuxBridge ¶
type LinuxBridge struct {
// contains filtered or unexported fields
}
func NewLinuxBridge ¶
func NewLinuxBridge(name string, mtu int) *LinuxBridge
func (*LinuxBridge) AddSlave ¶
func (b *LinuxBridge) AddSlave(name string) error
func (*LinuxBridge) CallIptables ¶
func (b *LinuxBridge) CallIptables(value int) error
func (*LinuxBridge) Close ¶
func (b *LinuxBridge) Close() error
func (*LinuxBridge) DelSlave ¶
func (b *LinuxBridge) DelSlave(name string) error
func (*LinuxBridge) Delay ¶
func (b *LinuxBridge) Delay(value int) error
func (*LinuxBridge) Kernel ¶
func (b *LinuxBridge) Kernel() string
func (*LinuxBridge) ListMac ¶
func (b *LinuxBridge) ListMac() <-chan *MacFdb
func (*LinuxBridge) ListSlave ¶
func (b *LinuxBridge) ListSlave() <-chan Taper
func (*LinuxBridge) Mtu ¶
func (b *LinuxBridge) Mtu() int
func (*LinuxBridge) Name ¶
func (b *LinuxBridge) Name() string
func (*LinuxBridge) Open ¶
func (b *LinuxBridge) Open(addr string)
func (*LinuxBridge) Stats ¶
func (b *LinuxBridge) Stats() DeviceStats
func (*LinuxBridge) Stp ¶
func (b *LinuxBridge) Stp(enable bool) error
func (*LinuxBridge) String ¶
func (b *LinuxBridge) String() string
func (*LinuxBridge) Type ¶
func (b *LinuxBridge) Type() string
type Taper ¶
type Taper interface { Type() string IsTun() bool Name() string Read([]byte) (int, error) // read data from kernel to user space Write([]byte) (int, error) // write data from user space to kernel Send([]byte) (int, error) // send data from virtual bridge to kernel Recv([]byte) (int, error) // recv data from kernel to virtual bridge Close() error Master() Bridger SetMaster(dev Bridger) error Up() Down() Tenant() string Mtu() int String() string Has(v uint) bool }
type VirtualBridge ¶
type VirtualBridge struct {
// contains filtered or unexported fields
}
func NewVirtualBridge ¶
func NewVirtualBridge(name string, mtu int) *VirtualBridge
func (*VirtualBridge) AddMac ¶
func (b *VirtualBridge) AddMac(mac string, fdb *MacFdb)
func (*VirtualBridge) AddSlave ¶
func (b *VirtualBridge) AddSlave(name string) error
func (*VirtualBridge) CallIptables ¶
func (b *VirtualBridge) CallIptables(value int) error
func (*VirtualBridge) Close ¶
func (b *VirtualBridge) Close() error
func (*VirtualBridge) DelSlave ¶
func (b *VirtualBridge) DelSlave(name string) error
func (*VirtualBridge) Delay ¶
func (b *VirtualBridge) Delay(value int) error
func (*VirtualBridge) Eth2Str ¶
func (b *VirtualBridge) Eth2Str(addr []byte) string
func (*VirtualBridge) Expire ¶
func (b *VirtualBridge) Expire() error
func (*VirtualBridge) Flood ¶
func (b *VirtualBridge) Flood(m *Framer) error
func (*VirtualBridge) Forward ¶
func (b *VirtualBridge) Forward(m *Framer) error
func (*VirtualBridge) GetMac ¶
func (b *VirtualBridge) GetMac(mac string) *MacFdb
func (*VirtualBridge) Input ¶
func (b *VirtualBridge) Input(m *Framer) error
func (*VirtualBridge) Kernel ¶
func (b *VirtualBridge) Kernel() string
func (*VirtualBridge) Learn ¶
func (b *VirtualBridge) Learn(m *Framer)
func (*VirtualBridge) ListMac ¶
func (b *VirtualBridge) ListMac() <-chan *MacFdb
func (*VirtualBridge) ListSlave ¶
func (b *VirtualBridge) ListSlave() <-chan Taper
func (*VirtualBridge) Mtu ¶
func (b *VirtualBridge) Mtu() int
func (*VirtualBridge) Name ¶
func (b *VirtualBridge) Name() string
func (*VirtualBridge) Open ¶
func (b *VirtualBridge) Open(addr string)
func (*VirtualBridge) Start ¶
func (b *VirtualBridge) Start()
func (*VirtualBridge) Stats ¶
func (b *VirtualBridge) Stats() DeviceStats
func (*VirtualBridge) Stp ¶
func (b *VirtualBridge) Stp(enable bool) error
func (*VirtualBridge) String ¶
func (b *VirtualBridge) String() string
func (*VirtualBridge) Type ¶
func (b *VirtualBridge) Type() string
func (*VirtualBridge) UniCast ¶
func (b *VirtualBridge) UniCast(m *Framer) error
func (*VirtualBridge) UpdateMac ¶
func (b *VirtualBridge) UpdateMac(mac string, device Taper)
type VirtualTap ¶
type VirtualTap struct {
// contains filtered or unexported fields
}
func NewVirtualTap ¶
func NewVirtualTap(tenant string, c TapConfig) (*VirtualTap, error)
func (*VirtualTap) Close ¶
func (t *VirtualTap) Close() error
func (*VirtualTap) Down ¶
func (t *VirtualTap) Down()
func (*VirtualTap) Has ¶
func (t *VirtualTap) Has(v uint) bool
func (*VirtualTap) IsTun ¶
func (t *VirtualTap) IsTun() bool
func (*VirtualTap) Master ¶
func (t *VirtualTap) Master() Bridger
func (*VirtualTap) Mtu ¶
func (t *VirtualTap) Mtu() int
func (*VirtualTap) Name ¶
func (t *VirtualTap) Name() string
func (*VirtualTap) SetMaster ¶
func (t *VirtualTap) SetMaster(dev Bridger) error
func (*VirtualTap) String ¶
func (t *VirtualTap) String() string
func (*VirtualTap) Tenant ¶
func (t *VirtualTap) Tenant() string
func (*VirtualTap) Type ¶
func (t *VirtualTap) Type() string
func (*VirtualTap) Up ¶
func (t *VirtualTap) Up()
Click to show internal directories.
Click to hide internal directories.