Documentation
¶
Index ¶
- Constants
- Variables
- type Codec
- type CodecARP
- type CodecEthernet
- type CodecICMP
- type CodecICMPv6
- type CodecIPv4
- type CodecIPv6
- type CodecIPv6Fragment
- type CodecIPv6HopByHop
- type CodecIPv6HopByHopOption
- type CodecRaw
- type EtherType
- type IPAddress
- type Packet
- type PayloadFormat
- type TunTapConfig
- type TunTapImpl
- func (t *TunTapImpl) AddIPAddresses(addresses []*IPAddress) (int, error)
- func (t *TunTapImpl) Close() error
- func (t *TunTapImpl) MTU() (int, error)
- func (t *TunTapImpl) Name() (string, error)
- func (t *TunTapImpl) NativeFormat() PayloadFormat
- func (t *TunTapImpl) Open(outputFormat PayloadFormat) error
- func (t *TunTapImpl) OutputFormat() PayloadFormat
- func (t *TunTapImpl) RawFile() (*os.File, error)
- func (t *TunTapImpl) Read() (*Packet, error)
- func (t *TunTapImpl) SetMTU(mtu int) error
- func (t *TunTapImpl) Write(packet *Packet, pmtud bool) error
- type Tunnel
- type TunnelConfig
- type VxlanConfig
- type VxlanImpl
- func (t *VxlanImpl) AddIPAddresses(addresses []*IPAddress) (int, error)
- func (t *VxlanImpl) Close() error
- func (t *VxlanImpl) MTU() (int, error)
- func (t *VxlanImpl) Name() (string, error)
- func (t *VxlanImpl) NativeFormat() PayloadFormat
- func (t *VxlanImpl) Open(outputFormat PayloadFormat) error
- func (t *VxlanImpl) OutputFormat() PayloadFormat
- func (t *VxlanImpl) RawFile() (*os.File, error)
- func (t *VxlanImpl) Read() (*Packet, error)
- func (t *VxlanImpl) SetMTU(mtu int) error
- func (t *VxlanImpl) Write(packet *Packet, pmtud bool) error
Constants ¶
View Source
const ( DefaultMRU = 65536 DefaultMTU = 1500 DefaultTTL = 64 DefaultPostProcessBufferSize = 16 EthernetHeaderSize = 14 )
Variables ¶
View Source
var ( ErrUnsupportedFeature = errors.New("gophertun: feature unsupported on this platform") ErrUnsupportedProtocol = errors.New("gophertun: protocol unsupported") )
Functions ¶
This section is empty.
Types ¶
type CodecARP ¶
type CodecEthernet ¶
type CodecEthernet struct { Destination net.HardwareAddr Source net.HardwareAddr Type EtherType Payload Codec }
func (*CodecEthernet) Decode ¶
func (c *CodecEthernet) Decode(buf []byte) error
func (*CodecEthernet) Encode ¶
func (c *CodecEthernet) Encode() ([]byte, error)
func (*CodecEthernet) NextLayer ¶
func (c *CodecEthernet) NextLayer() Codec
func (*CodecEthernet) String ¶
func (c *CodecEthernet) String() string
type CodecICMPv6 ¶
type CodecICMPv6 struct { Type uint8 Code uint8 Checksum uint16 Omni uint32 Payload Codec // contains filtered or unexported fields }
func (*CodecICMPv6) Decode ¶
func (c *CodecICMPv6) Decode(buf []byte) error
func (*CodecICMPv6) Encode ¶
func (c *CodecICMPv6) Encode() ([]byte, error)
func (*CodecICMPv6) NextLayer ¶
func (c *CodecICMPv6) NextLayer() Codec
func (*CodecICMPv6) String ¶
func (c *CodecICMPv6) String() string
type CodecIPv4 ¶
type CodecIPv6 ¶
type CodecIPv6Fragment ¶
type CodecIPv6Fragment struct { NextHeader uint8 Reserved1 uint8 FragmentOffset uint16 // raw * 8 Reserved2 uint8 MoreFragment bool Identification uint32 Payload Codec // contains filtered or unexported fields }
func (*CodecIPv6Fragment) Decode ¶
func (c *CodecIPv6Fragment) Decode(buf []byte) error
func (*CodecIPv6Fragment) Encode ¶
func (c *CodecIPv6Fragment) Encode() ([]byte, error)
func (*CodecIPv6Fragment) NextLayer ¶
func (c *CodecIPv6Fragment) NextLayer() Codec
func (*CodecIPv6Fragment) String ¶
func (c *CodecIPv6Fragment) String() string
type CodecIPv6HopByHop ¶
type CodecIPv6HopByHop struct { NextHeader uint8 HeaderLength uint16 // raw * 8 + 8 FirstOption *CodecIPv6HopByHopOption Payload Codec // contains filtered or unexported fields }
func (*CodecIPv6HopByHop) Decode ¶
func (c *CodecIPv6HopByHop) Decode(buf []byte) error
func (*CodecIPv6HopByHop) Encode ¶
func (c *CodecIPv6HopByHop) Encode() ([]byte, error)
func (*CodecIPv6HopByHop) NextLayer ¶
func (c *CodecIPv6HopByHop) NextLayer() Codec
func (*CodecIPv6HopByHop) String ¶
func (c *CodecIPv6HopByHop) String() string
type CodecIPv6HopByHopOption ¶
type CodecIPv6HopByHopOption struct { Type uint8 DataLength uint8 Data Codec NextOption *CodecIPv6HopByHopOption }
func (*CodecIPv6HopByHopOption) Decode ¶
func (c *CodecIPv6HopByHopOption) Decode(buf []byte) error
func (*CodecIPv6HopByHopOption) Encode ¶
func (c *CodecIPv6HopByHopOption) Encode() ([]byte, error)
func (*CodecIPv6HopByHopOption) NextLayer ¶
func (c *CodecIPv6HopByHopOption) NextLayer() Codec
func (*CodecIPv6HopByHopOption) String ¶
func (c *CodecIPv6HopByHopOption) String() string
type Packet ¶
type Packet struct { Format PayloadFormat EtherType EtherType Payload []byte Extra []byte }
func (*Packet) ConvertTo ¶
func (p *Packet) ConvertTo(outputFormat PayloadFormat, hwAddr net.HardwareAddr) (*Packet, error)
type PayloadFormat ¶
type PayloadFormat int
const ( FormatUnknown PayloadFormat = iota FormatIP FormatEthernet )
type TunTapConfig ¶
type TunTapConfig struct { NameHint string AllowNameSuffix bool PreferredNativeFormat PayloadFormat ExtraFlags uint32 }
func (*TunTapConfig) Create ¶
func (c *TunTapConfig) Create() (Tunnel, error)
type TunTapImpl ¶
type TunTapImpl struct {
// contains filtered or unexported fields
}
func (*TunTapImpl) AddIPAddresses ¶
func (t *TunTapImpl) AddIPAddresses(addresses []*IPAddress) (int, error)
func (*TunTapImpl) Close ¶
func (t *TunTapImpl) Close() error
func (*TunTapImpl) MTU ¶
func (t *TunTapImpl) MTU() (int, error)
func (*TunTapImpl) Name ¶
func (t *TunTapImpl) Name() (string, error)
func (*TunTapImpl) NativeFormat ¶
func (t *TunTapImpl) NativeFormat() PayloadFormat
func (*TunTapImpl) Open ¶
func (t *TunTapImpl) Open(outputFormat PayloadFormat) error
func (*TunTapImpl) OutputFormat ¶
func (t *TunTapImpl) OutputFormat() PayloadFormat
func (*TunTapImpl) Read ¶
func (t *TunTapImpl) Read() (*Packet, error)
func (*TunTapImpl) SetMTU ¶
func (t *TunTapImpl) SetMTU(mtu int) error
type Tunnel ¶
type Tunnel interface { AddIPAddresses(addresses []*IPAddress) (int, error) Close() error MTU() (int, error) Name() (string, error) NativeFormat() PayloadFormat Open(outputFormat PayloadFormat) error OutputFormat() PayloadFormat RawFile() (*os.File, error) Read() (*Packet, error) SetMTU(mtu int) error Write(packet *Packet, pmtud bool) error }
type TunnelConfig ¶
type VxlanConfig ¶
type VxlanConfig struct { VxlanConn net.PacketConn VxlanNetworkID uint32 VxlanTunnelEndpoint net.Addr }
func (*VxlanConfig) Create ¶
func (c *VxlanConfig) Create() (Tunnel, error)
type VxlanImpl ¶
type VxlanImpl struct {
// contains filtered or unexported fields
}
func (*VxlanImpl) AddIPAddresses ¶
func (*VxlanImpl) NativeFormat ¶
func (t *VxlanImpl) NativeFormat() PayloadFormat
func (*VxlanImpl) Open ¶
func (t *VxlanImpl) Open(outputFormat PayloadFormat) error
func (*VxlanImpl) OutputFormat ¶
func (t *VxlanImpl) OutputFormat() PayloadFormat
Source Files
¶
Click to show internal directories.
Click to hide internal directories.