nls

package module
v0.0.0-...-362b2aa Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2019 License: MIT Imports: 19 Imported by: 0

README

Documentation

Overview

Package NoiseLink_2 is a generated protocol buffer package.

It is generated from these files:

NoiseLink.2.proto

It has these top-level messages:

NoiseLinkNegotiationDataRequest1
NoiseLinkEarlyHandshakePayload
NoiseLinkNegotiationDataResponse1
NoiseLinkHandshakePayloadResponse1
NoiseLinkHandshakePayloadRequest2
NoiseZeroLinkHandshakePayloadRequest1
NoiseZeroLinkHandshakePayloadResponse1

Index

Constants

View Source
const (
	NOISE_DH_CURVE25519 = 1

	NOISE_CIPHER_CHACHAPOLY = 1
	NOISE_CIPHER_AESGCM     = 2

	NOISE_HASH_BLAKE2s = 1
	NOISE_HASH_BLAKE2b = 2
	NOISE_HASH_SHA256  = 3
	NOISE_HASH_SHA512  = 4

	NOISE_PATTERN_XX          = 9
	NOISE_PATTERN_IK          = 14
	NOISE_PATTERN_XX_FALLBACK = 16
)

from noise-c https://github.com/rweather/noise-c/blob/master/include/noise/protocol/constants.h

View Source
const (
	RESPONSE_SWITCH = iota
	RESPONSE_RETRY
	RESPONSE_REJECT
)
View Source
const MaxPayloadSize = math.MaxUint16 - 16 - uint16Size /*data len*/

Variables

This section is empty.

Functions

func HashKey

func HashKey(data []byte) uint64

func Listen

func Listen(laddr string, config *ConnectionConfig) (net.Listener, error)

Listen creates a TLS listener accepting connections on the given network address using net.Listen.

Types

type Conn

type Conn struct {
	HandshakeData []byte
	// contains filtered or unexported fields
}

func Dial

func Dial(addr string, localaddr string, config *ConnectionConfig) (*Conn, error)

func (*Conn) ChannelBinding

func (c *Conn) ChannelBinding() []byte

func (*Conn) Close

func (c *Conn) Close() error

Close closes the connection.

func (*Conn) ConnectionState

func (c *Conn) ConnectionState() tls.ConnectionState

func (*Conn) Handshake

func (c *Conn) Handshake() error

Handshake runs the client or server handshake protocol if it has not yet been run. Most uses of this package need not call Handshake explicitly: the first Read or Write will call it automatically.

func (*Conn) InitializePacket

func (c *Conn) InitializePacket() *buffer

InitializePacket adds additional sub-messages if needed

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

LocalAddr returns the local network address.

func (*Conn) Read

func (c *Conn) Read(b []byte) (n int, err error)

Read reads data from the connection. Read can be made to time out and return a Error with Timeout() == true after a fixed time limit; see SetDeadline and SetReadDeadline.

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

RemoteAddr returns the remote network address.

func (*Conn) RunClientHandshake

func (c *Conn) RunClientHandshake() error

func (*Conn) RunServerHandshake

func (c *Conn) RunServerHandshake() error

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

SetDeadline sets the read and write deadlines associated with the connection. A zero value for t means Read and Write will not time out. After a Write has timed out, the TLS state is corrupt and all future writes will return the same error.

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

SetReadDeadline sets the read deadline on the underlying connection. A zero value for t means Read will not time out.

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

SetWriteDeadline sets the write deadline on the underlying connection. A zero value for t means Write will not time out. After a Write has timed out, the TLS state is corrupt and all future writes will return the same error.

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

type ConnectionConfig

type ConnectionConfig struct {
	VerifyCallback VerifyCallbackFunc
	Payload        []byte //certificates, signs etc
	StaticKeypair  noise.DHKey
	PeerStatic     []byte
	Padding        uint16

	ServerName      string
	InitialProtocol string
	SwitchProtocols []string
	RetryProtocols  []string
	// contains filtered or unexported fields
}

type ConnectionInfo

type ConnectionInfo struct {
	Name          string
	Index         byte
	PeerKey       []byte
	ServerPublic  []byte
	HandshakeHash []byte
}

type NoiseLinkEarlyHandshakePayload

type NoiseLinkEarlyHandshakePayload struct {
	EvidenceRequestType []string `protobuf:"bytes,1,rep,name=evidence_request_type,json=evidenceRequestType" json:"evidence_request_type,omitempty"`
}

func (*NoiseLinkEarlyHandshakePayload) Descriptor

func (*NoiseLinkEarlyHandshakePayload) Descriptor() ([]byte, []int)

func (*NoiseLinkEarlyHandshakePayload) GetEvidenceRequestType

func (m *NoiseLinkEarlyHandshakePayload) GetEvidenceRequestType() []string

func (*NoiseLinkEarlyHandshakePayload) ProtoMessage

func (*NoiseLinkEarlyHandshakePayload) ProtoMessage()

func (*NoiseLinkEarlyHandshakePayload) Reset

func (m *NoiseLinkEarlyHandshakePayload) Reset()

func (*NoiseLinkEarlyHandshakePayload) String

type NoiseLinkHandshakePayloadRequest2

type NoiseLinkHandshakePayloadRequest2 struct {
	EvidenceBlobType []string `protobuf:"bytes,2,rep,name=evidence_blob_type,json=evidenceBlobType" json:"evidence_blob_type,omitempty"`
	EvidenceBlob     [][]byte `protobuf:"bytes,3,rep,name=evidence_blob,json=evidenceBlob,proto3" json:"evidence_blob,omitempty"`
}

func (*NoiseLinkHandshakePayloadRequest2) Descriptor

func (*NoiseLinkHandshakePayloadRequest2) Descriptor() ([]byte, []int)

func (*NoiseLinkHandshakePayloadRequest2) GetEvidenceBlob

func (m *NoiseLinkHandshakePayloadRequest2) GetEvidenceBlob() [][]byte

func (*NoiseLinkHandshakePayloadRequest2) GetEvidenceBlobType

func (m *NoiseLinkHandshakePayloadRequest2) GetEvidenceBlobType() []string

func (*NoiseLinkHandshakePayloadRequest2) ProtoMessage

func (*NoiseLinkHandshakePayloadRequest2) ProtoMessage()

func (*NoiseLinkHandshakePayloadRequest2) Reset

func (*NoiseLinkHandshakePayloadRequest2) String

type NoiseLinkHandshakePayloadResponse1

type NoiseLinkHandshakePayloadResponse1 struct {
	EvidenceRequestType []string `protobuf:"bytes,1,rep,name=evidence_request_type,json=evidenceRequestType" json:"evidence_request_type,omitempty"`
	EvidenceBlobType    []string `protobuf:"bytes,2,rep,name=evidence_blob_type,json=evidenceBlobType" json:"evidence_blob_type,omitempty"`
	EvidenceBlob        [][]byte `protobuf:"bytes,3,rep,name=evidence_blob,json=evidenceBlob,proto3" json:"evidence_blob,omitempty"`
}

func (*NoiseLinkHandshakePayloadResponse1) Descriptor

func (*NoiseLinkHandshakePayloadResponse1) Descriptor() ([]byte, []int)

func (*NoiseLinkHandshakePayloadResponse1) GetEvidenceBlob

func (m *NoiseLinkHandshakePayloadResponse1) GetEvidenceBlob() [][]byte

func (*NoiseLinkHandshakePayloadResponse1) GetEvidenceBlobType

func (m *NoiseLinkHandshakePayloadResponse1) GetEvidenceBlobType() []string

func (*NoiseLinkHandshakePayloadResponse1) GetEvidenceRequestType

func (m *NoiseLinkHandshakePayloadResponse1) GetEvidenceRequestType() []string

func (*NoiseLinkHandshakePayloadResponse1) ProtoMessage

func (*NoiseLinkHandshakePayloadResponse1) ProtoMessage()

func (*NoiseLinkHandshakePayloadResponse1) Reset

func (*NoiseLinkHandshakePayloadResponse1) String

type NoiseLinkNegotiationDataRequest1

type NoiseLinkNegotiationDataRequest1 struct {
	ServerName      string                          `protobuf:"bytes,1,opt,name=server_name,json=serverName" json:"server_name,omitempty"`
	InitialProtocol string                          `protobuf:"bytes,2,opt,name=initial_protocol,json=initialProtocol" json:"initial_protocol,omitempty"`
	SwitchProtocol  []string                        `protobuf:"bytes,3,rep,name=switch_protocol,json=switchProtocol" json:"switch_protocol,omitempty"`
	RetryProtocol   []string                        `protobuf:"bytes,4,rep,name=retry_protocol,json=retryProtocol" json:"retry_protocol,omitempty"`
	EarlyPayload    *NoiseLinkEarlyHandshakePayload `protobuf:"bytes,6,opt,name=early_payload,json=earlyPayload" json:"early_payload,omitempty"`
}

func (*NoiseLinkNegotiationDataRequest1) Descriptor

func (*NoiseLinkNegotiationDataRequest1) Descriptor() ([]byte, []int)

func (*NoiseLinkNegotiationDataRequest1) GetEarlyPayload

func (*NoiseLinkNegotiationDataRequest1) GetInitialProtocol

func (m *NoiseLinkNegotiationDataRequest1) GetInitialProtocol() string

func (*NoiseLinkNegotiationDataRequest1) GetRetryProtocol

func (m *NoiseLinkNegotiationDataRequest1) GetRetryProtocol() []string

func (*NoiseLinkNegotiationDataRequest1) GetServerName

func (m *NoiseLinkNegotiationDataRequest1) GetServerName() string

func (*NoiseLinkNegotiationDataRequest1) GetSwitchProtocol

func (m *NoiseLinkNegotiationDataRequest1) GetSwitchProtocol() []string

func (*NoiseLinkNegotiationDataRequest1) ProtoMessage

func (*NoiseLinkNegotiationDataRequest1) ProtoMessage()

func (*NoiseLinkNegotiationDataRequest1) Reset

func (*NoiseLinkNegotiationDataRequest1) String

type NoiseLinkNegotiationDataResponse1

type NoiseLinkNegotiationDataResponse1 struct {
	// Types that are valid to be assigned to Response:
	//	*NoiseLinkNegotiationDataResponse1_SwitchProtocol
	//	*NoiseLinkNegotiationDataResponse1_RetryProtocol
	//	*NoiseLinkNegotiationDataResponse1_Rejected
	Response isNoiseLinkNegotiationDataResponse1_Response `protobuf_oneof:"response"`
}

func (*NoiseLinkNegotiationDataResponse1) Descriptor

func (*NoiseLinkNegotiationDataResponse1) Descriptor() ([]byte, []int)

func (*NoiseLinkNegotiationDataResponse1) GetRejected

func (m *NoiseLinkNegotiationDataResponse1) GetRejected() bool

func (*NoiseLinkNegotiationDataResponse1) GetResponse

func (m *NoiseLinkNegotiationDataResponse1) GetResponse() isNoiseLinkNegotiationDataResponse1_Response

func (*NoiseLinkNegotiationDataResponse1) GetRetryProtocol

func (m *NoiseLinkNegotiationDataResponse1) GetRetryProtocol() string

func (*NoiseLinkNegotiationDataResponse1) GetSwitchProtocol

func (m *NoiseLinkNegotiationDataResponse1) GetSwitchProtocol() string

func (*NoiseLinkNegotiationDataResponse1) ProtoMessage

func (*NoiseLinkNegotiationDataResponse1) ProtoMessage()

func (*NoiseLinkNegotiationDataResponse1) Reset

func (*NoiseLinkNegotiationDataResponse1) String

func (*NoiseLinkNegotiationDataResponse1) XXX_OneofFuncs

func (*NoiseLinkNegotiationDataResponse1) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type NoiseLinkNegotiationDataResponse1_Rejected

type NoiseLinkNegotiationDataResponse1_Rejected struct {
	Rejected bool `protobuf:"varint,5,opt,name=rejected,oneof"`
}

type NoiseLinkNegotiationDataResponse1_RetryProtocol

type NoiseLinkNegotiationDataResponse1_RetryProtocol struct {
	RetryProtocol string `protobuf:"bytes,4,opt,name=retry_protocol,json=retryProtocol,oneof"`
}

type NoiseLinkNegotiationDataResponse1_SwitchProtocol

type NoiseLinkNegotiationDataResponse1_SwitchProtocol struct {
	SwitchProtocol string `protobuf:"bytes,3,opt,name=switch_protocol,json=switchProtocol,oneof"`
}

type NoiseZeroLinkHandshakePayloadRequest1

type NoiseZeroLinkHandshakePayloadRequest1 struct {
	EvidenceRequestType []string `protobuf:"bytes,1,rep,name=evidence_request_type,json=evidenceRequestType" json:"evidence_request_type,omitempty"`
	EvidenceBlobType    []string `protobuf:"bytes,2,rep,name=evidence_blob_type,json=evidenceBlobType" json:"evidence_blob_type,omitempty"`
	EvidenceBlob        [][]byte `protobuf:"bytes,3,rep,name=evidence_blob,json=evidenceBlob,proto3" json:"evidence_blob,omitempty"`
}

func (*NoiseZeroLinkHandshakePayloadRequest1) Descriptor

func (*NoiseZeroLinkHandshakePayloadRequest1) Descriptor() ([]byte, []int)

func (*NoiseZeroLinkHandshakePayloadRequest1) GetEvidenceBlob

func (m *NoiseZeroLinkHandshakePayloadRequest1) GetEvidenceBlob() [][]byte

func (*NoiseZeroLinkHandshakePayloadRequest1) GetEvidenceBlobType

func (m *NoiseZeroLinkHandshakePayloadRequest1) GetEvidenceBlobType() []string

func (*NoiseZeroLinkHandshakePayloadRequest1) GetEvidenceRequestType

func (m *NoiseZeroLinkHandshakePayloadRequest1) GetEvidenceRequestType() []string

func (*NoiseZeroLinkHandshakePayloadRequest1) ProtoMessage

func (*NoiseZeroLinkHandshakePayloadRequest1) ProtoMessage()

func (*NoiseZeroLinkHandshakePayloadRequest1) Reset

func (*NoiseZeroLinkHandshakePayloadRequest1) String

type NoiseZeroLinkHandshakePayloadResponse1

type NoiseZeroLinkHandshakePayloadResponse1 struct {
	EvidenceBlobType []string `protobuf:"bytes,2,rep,name=evidence_blob_type,json=evidenceBlobType" json:"evidence_blob_type,omitempty"`
	EvidenceBlob     [][]byte `protobuf:"bytes,3,rep,name=evidence_blob,json=evidenceBlob,proto3" json:"evidence_blob,omitempty"`
}

func (*NoiseZeroLinkHandshakePayloadResponse1) Descriptor

func (*NoiseZeroLinkHandshakePayloadResponse1) Descriptor() ([]byte, []int)

func (*NoiseZeroLinkHandshakePayloadResponse1) GetEvidenceBlob

func (m *NoiseZeroLinkHandshakePayloadResponse1) GetEvidenceBlob() [][]byte

func (*NoiseZeroLinkHandshakePayloadResponse1) GetEvidenceBlobType

func (m *NoiseZeroLinkHandshakePayloadResponse1) GetEvidenceBlobType() []string

func (*NoiseZeroLinkHandshakePayloadResponse1) ProtoMessage

func (*NoiseZeroLinkHandshakePayloadResponse1) Reset

func (*NoiseZeroLinkHandshakePayloadResponse1) String

type VerifyCallbackFunc

type VerifyCallbackFunc func(publicKey []byte, data []byte) error

Jump to

Keyboard shortcuts

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