Documentation ¶
Overview ¶
Simple secure free software virtual private network daemon
Index ¶
- Constants
- Variables
- func ConnListen(conn *net.UDPConn) (chan *UDPPkt, []byte, chan struct{})
- func IsValidHandshakePkt(pkt []byte) bool
- func KeyRead(path string) *[KeySize]byte
- func PeersInit(path string)
- func ScriptCall(path, ifaceName string) ([]byte, error)
- type Handshake
- type Peer
- type PeerId
- type TAP
- type UDPPkt
Constants ¶
const ( NonceSize = 8 KeySize = 32 // S20BS is Salsa20's internal blocksize in bytes S20BS = 64 HeartbeatSize = 12 // Maximal amount of bytes transfered with single key (4 GiB) MaxBytesPerKey = 4294967296 )
const (
IDSize = 128 / 8
)
Variables ¶
var ( MTU int Timeout int Noncediff int Version string )
var ( PeersPath string IDsCache cipherCache )
var ( HeartbeatMark = []byte("\x00\x00\x00HEARTBEAT") Emptiness = make([]byte, KeySize) )
Functions ¶
func ConnListen ¶
Create UDP listening goroutine. This function takes already listening UDP socket and a buffer where all UDP packet data will be saved, channel where information about remote address and number of written bytes are stored, and a channel used to tell that buffer is ready to be overwritten.
func IsValidHandshakePkt ¶
Check if it is valid handshake-related message. Minimal size and last 16 zero bytes.
func ScriptCall ¶
Call external program/script. You have to specify path to it and (inteface name as a rule) something that will be the first argument when calling it. Function will return it's output and possible error.
Types ¶
type Handshake ¶
func HandshakeStart ¶
Start handshake's procedure from the client. It is the entry point for starting the handshake procedure. You have to specify outgoing conn address, remote's addr address, our own identification and an encryption key. First handshake packet will be sent immediately.
func (*Handshake) Client ¶
Process handshake message on the client side. This function is intended to be called on client's side. Our outgoing conn connection, authentication key and received data are required. Client does not work with identities, as he is the only one, so key is a requirement. If this is the final handshake message, then new Peer object will be created and used as a transport. If no mutually authenticated Peer is ready, then return nil.
func (*Handshake) Server ¶
Process handshake message on the server side. This function is intended to be called on server's side. Our outgoing conn connection and received data are required. If this is the final handshake message, then new Peer object will be created and used as a transport. If no mutually authenticated Peer is ready, then return nil.
type Peer ¶
type Peer struct { Addr *net.UDPAddr Id PeerId Key *[KeySize]byte // encryption key NonceOur uint64 // nonce for our messages NonceRecv uint64 // latest received nonce from remote peer NonceCipher *xtea.Cipher // nonce cipher LastPing time.Time LastSent time.Time Bytes int // contains filtered or unexported fields }
func (*Peer) EthProcess ¶
Process incoming Ethernet packet. ethPkt is received data, conn is our outgoing connection. ready channel is TAPListen's synchronization channel used to tell him that he is free to receive new packets. Encrypted and authenticated packets will be sent to remote Peer side immediately.
func (*Peer) UDPProcess ¶
Process incoming UDP packet. udpPkt is received data, related to the peer tap interface and ConnListen'es synchronization channel used to tell him that he is free to receive new packets. Authenticated and decrypted packets will be written to the interface immediately (except heartbeat ones).
type PeerId ¶
type TAP ¶
type TAP struct { Name string // contains filtered or unexported fields }
func TAPListen ¶
Create TAP listening goroutine. This function takes required TAP interface name, opens it and allocates a buffer where all frame data will be written, channel where information about number of read bytes is sent to, synchronization channel (external processes tell that read buffer can be used again) and possible channel opening error.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
govpn-client
Simple secure free software virtual private network daemon.
|
Simple secure free software virtual private network daemon. |
govpn-server
Simple secure free software virtual private network daemon.
|
Simple secure free software virtual private network daemon. |