transport

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package transport implements a transport layer for SillyStack. It uses the Noise protocol to establish a secure connection between two peers using shared Curve25519 keys.

Basically secure service-to-service communication without the headache of certificates. The current implementation is extremely primitive and has many security limitations (probably even flaws, eg. leaking information about the size of the plaintext). But it's a start and will be improved over time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParsePublicKey added in v0.1.6

func ParsePublicKey(encodedPublicKey string) ([]byte, error)

ParsePublicKey parses a base64 encoded public key.

Types

type Conn

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

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) LocalAddr added in v0.1.6

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

func (*Conn) Read

func (c *Conn) Read(data []byte) (int, error)

func (*Conn) RemoteAddr added in v0.1.6

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

func (*Conn) SetDeadline added in v0.1.6

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

func (*Conn) SetReadDeadline added in v0.1.6

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

func (*Conn) SetWriteDeadline added in v0.1.6

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

func (*Conn) Write

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

type CredentialsBuilder added in v0.1.6

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

CredentialsBuilder is used to build gRPC transport credentials.

func Builder added in v0.1.6

func Builder() *CredentialsBuilder

func (*CredentialsBuilder) Build added in v0.1.6

func (*CredentialsBuilder) WithKey added in v0.1.6

func (b *CredentialsBuilder) WithKey(key Key) *CredentialsBuilder

WithKey sets the current peers private key.

func (*CredentialsBuilder) WithKnownPeers added in v0.1.6

func (b *CredentialsBuilder) WithKnownPeers(knownPeers KnownPeersFunc) *CredentialsBuilder

WithKnownPeers configures a function that will be used to lookup the public key of known peers. This is only required for clients.

func (*CredentialsBuilder) WithLogger added in v0.1.6

func (b *CredentialsBuilder) WithLogger(logger *zap.Logger) *CredentialsBuilder

WithLogger can be used to enable logging the handshake process.

func (*CredentialsBuilder) WithVerifyPeer added in v0.1.6

func (b *CredentialsBuilder) WithVerifyPeer(verify VerifyPeerFunc) *CredentialsBuilder

WithVerifyPeer configures an optional function that will be used to verify a peers public key. This is only required for servers.

type Key added in v0.1.6

type Key noise.DHKey

Key is a Curve25519 key pair.

func ParsePrivateKey

func ParsePrivateKey(encodedPrivateKey string) (*Key, error)

ParsePrivateKey parses a base64 encoded private key.

type KnownPeersFunc added in v0.1.6

type KnownPeersFunc func(address string) ([]byte, error)

KnownPeersFunc is a function that looks up the public key of known peers.

type VerifyPeerFunc added in v0.1.6

type VerifyPeerFunc func(publicKey []byte) error

VerifyPeerFunc is used to verify a peers public key.

Jump to

Keyboard shortcuts

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