Documentation ¶
Index ¶
- Constants
- Variables
- type Connector
- func NewIP(p byte, t time.Duration) Connector
- func NewSecureTCP(t time.Duration, c *tls.Config) (Connector, error)
- func NewSecureUNIX(t time.Duration, c *tls.Config) (Connector, error)
- func NewTCP(t time.Duration) (Connector, error)
- func NewUDP(t time.Duration) Connector
- func NewUNIX(t time.Duration) (Connector, error)
- type Flag
- func (f *Flag) Clear()
- func (f Flag) Group() uint16
- func (f Flag) Len() uint16
- func (f Flag) MarshalStream(w data.Writer) error
- func (f Flag) Position() uint16
- func (f *Flag) Set(n Flag)
- func (f *Flag) SetGroup(n uint16)
- func (f *Flag) SetLen(n uint16)
- func (f *Flag) SetPosition(n uint16)
- func (f Flag) String() string
- func (f *Flag) UnmarshalStream(r data.Reader) error
- func (f *Flag) Unset(n Flag)
- type Packet
Constants ¶
const DefaultTimeout = time.Duration(60) * time.Second
DefaultTimeout is the default timeout used for the default connectors. The default is 60 seconds (one minute).
const PacketHeaderSize = 45
PacketHeaderSize is the length of the Packet header in bytes.
Variables ¶
var ( // TCP is the TCP Raw connector. This connector uses raw TCP connections for communication. TCP = &tcpConnector{dialer: &net.Dialer{Timeout: DefaultTimeout, KeepAlive: DefaultTimeout, DualStack: true}} // UDP is the UDP Raw connector. This connector uses raw UDP connections for communication. UDP = NewUDP(DefaultTimeout) // ICMP is the ICMP Raw connector. This connector uses raw ICMP connections for communication. ICMP = NewIP(1, DefaultTimeout) // TLS is the TCP over TLS connector client. This client uses TCP wrapped in TLS encryption // using certificates. This client is only valid for clients that connect to servers with properly // signed and trusted certificates. TLS = &tcpClient{c: tcpConnector{tls: new(tls.Config), dialer: TCP.dialer}} // TLSNoCheck is the TCP over TLS connector profile. This client uses TCP wrapped in TLS encryption // using certificates. This instance DOES NOT check the server certificate for validity. TLSNoCheck = &tcpClient{c: tcpConnector{tls: &tls.Config{InsecureSkipVerify: true}, dialer: TCP.dialer}} )
var ErrInvalidTLSConfig = xerr.New("TLS configuration is missing certificates")
ErrInvalidTLSConfig is returned when attempting to use the default TLS Connector as a listener. This error is also returned when attemtping to use a TLS configuration that does not have a valid server certificates.
var ListenConfig = net.ListenConfig{KeepAlive: DefaultTimeout}
ListenConfig is the default listener config that is used to generate the Listeners. This can be used to specify the listen 'KeepAlive' timeout.
Functions ¶
This section is empty.
Types ¶
type Connector ¶
Connector is an interface that represents an object that can create and establish connections on various protocols.
func NewIP ¶
NewIP creates a new simple IP based connector with the supplied timeout and protocol number.
func NewSecureTCP ¶
NewSecureTCP creates a new simple TLS wrapped TCP based connector with the supplied timeout.
func NewSecureUNIX ¶
NewSecureUNIX creates a new simple TLS wrapped UNIX socket based connector with the supplied timeout.
type Flag ¶
type Flag uint64
Flag is a bitwise integer that represents important information about the packet that its assigned to.
Mapping 64 56 48 40 32 24 16 8 0
| 8 4 2 1 | 8 4 2 1 | 8 4 2 1 | 8 4 2 1 | 8 4 2 1 | 8 4 2 1 | 8 4 2 1 | 8 4 2 1 | | Frag Total | Frag Position | Frag Group ID | Flags | | Frag Data | |
const ( // FlagData is a flag used to indicate that Hello/Echo/Sleep packets // also include additional data to be read. FlagData Flag = 1 << iota // FlagFrag is a flag used to indicate that the packet is part of a // fragment group (PacketGroup) and the server should re-assemble the packet // before preforming actions on it. FlagFrag // FlagMulti is a flag used to indicate that the packet is a container // for multiple packets, auto addded by a processing agent. FlagMulti // FlagProxy is a flag used to indicate that the packet was sent from another client // acting as a forwarding proxy. FlagProxy // FlagError is a flag used to indicate that the packet indicates that an error // condition has occurred. The contents of the Packet can be used to understand the error cause. FlagError // FlagChannel is a flag used to signify that the connection should be converted into/from a single // channel connection. This means that the connection is kept alive and the client will not poll the server. // This flag will be present on the top level multi-packet if included in a single packet inside. This flag will // take affect on each hop that it goes through. Incompatible with 'FlagOneshot'. Has to be used once per connection. FlagChannel // FlagOneshot is used to signal that the Packet contains information and should not be used to // create or re-establish a session. FlagOneshot // FlagMultiDevice is used to determine if the Multi packet contains Packets with separate device IDs. // This is used to speed up processing and allows packets that are all destined for the same host to be // batch processed. FlagMultiDevice )
func (Flag) MarshalStream ¶
MarshalStream writes the data of this Flag to the supplied Writer.
func (*Flag) SetPosition ¶
SetPosition sets the position this packet is located in the fragment group.
func (*Flag) UnmarshalStream ¶
UnmarshalStream reads the data of this Flag from the supplied Reader.
type Packet ¶
Packet is a struct that is a Reader and Writer that can be generated to be sent, or received from a Connection. Acts as a data buffer and 'child' of 'data.Chunk'.
func (*Packet) Add ¶
Add attempts to combine the data and properties the supplied Packet with the existsing Packet. This function will return an error if the ID's have a mismatch or there was an error during the write operation.
func (Packet) Belongs ¶
Belongs returns true if the specified Packet is a Frag that was a part of the split Chunks of this as the original packet.
func (Packet) MarshalStream ¶
MarshalStream writes the data of this Packet to the supplied Writer.
func (Packet) Size ¶
Size returns the amount of bytes written or contained in this Packet with the header size added.
func (*Packet) UnmarshalStream ¶
UnmarshalStream reads the data of this Packet from the supplied Reader.