Documentation
¶
Overview ¶
Package tun is the public interface for the minivpn application. It exposes a tun device interface where the user of the application can write to and read from.
Index ¶
- Variables
- type TUN
- func (t *TUN) Close() error
- func (t *TUN) LocalAddr() net.Addr
- func (t *TUN) NetMask() net.IPMask
- func (t *TUN) Read(data []byte) (int, error)
- func (t *TUN) RemoteAddr() net.Addr
- func (t *TUN) SetDeadline(tm time.Time) error
- func (t *TUN) SetReadDeadline(tm time.Time) error
- func (t *TUN) SetWriteDeadline(tm time.Time) error
- func (t *TUN) Write(data []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrCannotHandshake is the generic error we return when we cannot complete a handshake. ErrCannotHandshake = errors.New("openvpn handshake error") )
Functions ¶
This section is empty.
Types ¶
type TUN ¶
type TUN struct {
// contains filtered or unexported fields
}
TUN allows to use channels to read and write. It also OWNS the underlying connection. TUN implements net.Conn
func StartTUN ¶
StartTUN initializes and starts the TUN device over the vpn. If the passed context expires before the TUN device is ready, an error will be returned.
func (*TUN) Close ¶
Close is an idempotent method that closes the underlying connection (owned by us) and potentially executes any registed callback.
func (*TUN) SetDeadline ¶
SetDeadline implements net.Conn
func (*TUN) SetReadDeadline ¶
SetReadDeadline implements net.Conn
func (*TUN) SetWriteDeadline ¶
SetWriteDeadline implements net.Conn