Documentation
¶
Index ¶
- func ChanToWriter(writer io.Writer, stream <-chan []byte) error
- func ReaderToChan(stream chan<- []byte, reader io.Reader) error
- type Address
- type Destination
- type DomainAddressImpl
- type IPv4Address
- type IPv6Address
- type Packet
- type PortAddress
- type TCPDestination
- type TCPPacket
- type TimeOutReader
- type UDPDestination
- type UDPPacket
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChanToWriter ¶
func ChanToWriter(writer io.Writer, stream <-chan []byte) error
ChanToWriter dumps all content from a given chan to a writer until the chan is closed.
func ReaderToChan ¶
func ReaderToChan(stream chan<- []byte, reader io.Reader) error
ReaderToChan dumps all content from a given reader to a chan by constantly reading it until EOF.
Types ¶
type Address ¶
type Address interface {
IP() net.IP // IP of this Address
Domain() string // Domain of this Address
Port() uint16 // Port of this Address
PortBytes() []byte // Port in bytes, network byte order
IsIPv4() bool // True if this Address is an IPv4 address
IsIPv6() bool // True if this Address is an IPv6 address
IsDomain() bool // True if this Address is an domain address
String() string // String representation of this Address
}
Address represents a network address to be communicated with. It may be an IP address or domain address, not both. This interface doesn't resolve IP address for a given domain.
func DomainAddress ¶
func DomainAddress(domain string, port uint16) Address
DomainAddress creates an Address with given domain and port.
type Destination ¶
type Destination interface {
Network() string // Protocol of communication (tcp / udp)
Address() Address // Address of destination
String() string // String representation of the destination
IsTCP() bool // True if destination is reachable via TCP
IsUDP() bool // True if destination is reachable via UDP
}
Destination represents a network destination including address and protocol (tcp / udp).
func NewTCPDestination ¶
func NewTCPDestination(address Address) Destination
NewTCPDestination creates a TCP destination with given address
func NewUDPDestination ¶
func NewUDPDestination(address Address) Destination
NewUDPDestination creates a UDP destination with given address
type DomainAddressImpl ¶
type DomainAddressImpl struct {
PortAddress
// contains filtered or unexported fields
}
type IPv4Address ¶
type IPv4Address struct {
PortAddress
// contains filtered or unexported fields
}
type IPv6Address ¶
type IPv6Address struct {
PortAddress
// contains filtered or unexported fields
}
type Packet ¶
type Packet interface {
Destination() Destination
Chunk() []byte // First chunk of this commnunication
MoreChunks() bool
}
type PortAddress ¶
type PortAddress struct {
// contains filtered or unexported fields
}
type TCPDestination ¶
type TCPDestination struct {
// contains filtered or unexported fields
}
type TCPPacket ¶
type TCPPacket struct {
// contains filtered or unexported fields
}
func NewTCPPacket ¶
func NewTCPPacket(dest Destination) *TCPPacket
func (TCPPacket) Destination ¶
func (base TCPPacket) Destination() Destination
func (*TCPPacket) MoreChunks ¶
func (packet *TCPPacket) MoreChunks() bool
type TimeOutReader ¶
type TimeOutReader struct {
// contains filtered or unexported fields
}
func NewTimeOutReader ¶
func NewTimeOutReader(timeout int, connection net.Conn) *TimeOutReader
type UDPDestination ¶
type UDPDestination struct {
// contains filtered or unexported fields
}
type UDPPacket ¶
type UDPPacket struct {
// contains filtered or unexported fields
}
func NewUDPPacket ¶
func NewUDPPacket(dest Destination, data []byte, token uint16) *UDPPacket
func (UDPPacket) Destination ¶
func (base UDPPacket) Destination() Destination
func (*UDPPacket) MoreChunks ¶
func (packet *UDPPacket) MoreChunks() bool
Click to show internal directories.
Click to hide internal directories.