Documentation
¶
Overview ¶
Package networkio implements raw packets network I/O.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPacketTooLarge = errors.New("openvpn: packet too large")
ErrPacketTooLarge means that a packet is larger than math.MaxUint16.
Functions ¶
This section is empty.
Types ¶
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
Dialer dials network connections. The zero value of this structure is invalid; please, use the NewDialer constructor.
func (*Dialer) DialContext ¶
DialContext establishes a connection and, on success, automatically wraps the returned connection to implement OpenVPN framing when not using UDP.
type FramingConn ¶
type FramingConn interface {
// ReadRawPacket reads and return a raw OpenVPN packet.
ReadRawPacket() ([]byte, error)
// WriteRawPacket writes a raw OpenVPN packet.
WriteRawPacket(pkt []byte) error
// SetReadDeadline is like net.Conn.SetReadDeadline.
SetReadDeadline(t time.Time) error
// SetWriteDeadline is like net.Conn.SetWriteDeadline.
SetWriteDeadline(t time.Time) error
// LocalAddr is like net.Conn.LocalAddr.
LocalAddr() net.Addr
// RemoteAddr is like net.Conn.RemoteAddr.
RemoteAddr() net.Addr
// Close is like net.Conn.Close.
Close() error
}
FramingConn is an OpenVPN network connection that knows about the framing used by OpenVPN to read and write raw packets.
type Service ¶
type Service struct {
// MuxerToNetwork moves bytes down from the muxer to the network IO layer
MuxerToNetwork chan []byte
// NetworkToMuxer moves bytes up from the network IO layer to the muxer
NetworkToMuxer *chan []byte
}
Service is the network I/O service. Make sure you initialize the channels before invoking Service.StartWorkers.
func (*Service) StartWorkers ¶
func (svc *Service) StartWorkers( config *config.Config, manager *workers.Manager, conn FramingConn, )
StartWorkers starts the network I/O workers. See the ARCHITECTURE file for more information about the network I/O workers.