wireguard

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2021 License: MIT Imports: 13 Imported by: 0

README

wireguard-oneshot

Documentation

Index

Constants

View Source
const (
	WGLabelMAC1   = "mac1----"
	WGLabelCookie = "cookie--"
)
View Source
const (
	NoiseConstruction = "Noise_IKpsk2_25519_ChaChaPoly_BLAKE2s"
	WGIdentifier      = "WireGuard v1 zx2c4 Jason@zx2c4.com"
)
View Source
const (
	MessageInitiationType  = 1
	MessageResponseType    = 2
	MessageCookieReplyType = 3
	MessageTransportType   = 4
)
View Source
const (
	MessageInitiationSize      = 148                                                    // size of handshake initiation message
	MessageResponseSize        = 92                                                     // size of response message
	MessageCookieReplySize     = 64                                                     // size of cookie reply message
	MessageTransportHeaderSize = 16                                                     // size of data preceding content in transport message
	MessageTransportSize       = MessageTransportHeaderSize + chacha20poly1305.Overhead // size of empty transport
	MessageKeepaliveSize       = MessageTransportSize                                   // size of keepalive
	MessageHandshakeSize       = MessageInitiationSize                                  // size of largest handshake related message
)
View Source
const (
	NoisePublicKeySize    = 32
	NoisePrivateKeySize   = 32
	NoisePresharedKeySize = 32
)
View Source
const (
	MessageTransportOffsetReceiver = 4
	MessageTransportOffsetCounter  = 8
	MessageTransportOffsetContent  = 16
)
View Source
const PaddingSize = 16
View Source
const UdpRecieveSize = 1500

Variables

View Source
var (
	InitialHash [blake2s.Size]byte
	ZeroNonce   [chacha20poly1305.NonceSize]byte
)

Functions

func UdpOneShot

func UdpOneShot(payload []byte, destinationIpAddress string, destinationPort int, config Configuration) ([]byte, error)

Types

type Configuration

type Configuration struct {
	PrivateKey      string
	PublicKey       string
	Endpoint        string
	ClientIpAddress string
}

type CookieGenerator

type CookieGenerator struct {
	// contains filtered or unexported fields
}

type Handshake

type Handshake struct {
	// contains filtered or unexported fields
}

type Keypair

type Keypair struct {
	// contains filtered or unexported fields
}

type MessageInitiation

type MessageInitiation struct {
	Type      uint32
	Sender    uint32
	Ephemeral NoisePublicKey
	Static    [NoisePublicKeySize + chacha20poly1305.Overhead]byte
	Timestamp [timestampSize + chacha20poly1305.Overhead]byte
	MAC1      [blake2s.Size128]byte
	MAC2      [blake2s.Size128]byte
}

type MessageResponse

type MessageResponse struct {
	Type      uint32
	Sender    uint32
	Receiver  uint32
	Ephemeral NoisePublicKey
	Empty     [chacha20poly1305.Overhead]byte
	MAC1      [blake2s.Size128]byte
	MAC2      [blake2s.Size128]byte
}

type NoisePresharedKey

type NoisePresharedKey [NoisePresharedKeySize]byte

type NoisePrivateKey

type NoisePrivateKey [NoisePrivateKeySize]byte

type NoisePublicKey

type NoisePublicKey [NoisePublicKeySize]byte

type Timestamp

type Timestamp [timestampSize]byte

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL