secure

package
v0.0.0-...-612934e Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKey

func GenerateKey(password string, sz int) []byte

Types

type Message

type Message struct {
	Nonce []byte
	Data  []byte
	Tag   []byte
}

func (Message) MarshalBytes

func (msg Message) MarshalBytes() []byte

func (*Message) UnmarshalBytes

func (msg *Message) UnmarshalBytes(data []byte) error

type Protocol

type Protocol struct {
	Debug bool
	// contains filtered or unexported fields
}

func NewProtocol

func NewProtocol(reader Reader, writer Writer) *Protocol

func WrapConnection

func WrapConnection(conn net.Conn) *Protocol

func (*Protocol) Accept

func (p *Protocol) Accept(keys map[string][]byte) error

func (*Protocol) Connect

func (p *Protocol) Connect(name string, key []byte) error

func (*Protocol) Read

func (p *Protocol) Read() ([]byte, error)

Read the next message

func (*Protocol) Write

func (p *Protocol) Write(data []byte) error

Write the message

type Reader

type Reader interface {
	ReadMessage() (Message, error)
}

type ReaderFunc

type ReaderFunc func() (Message, error)

func (ReaderFunc) ReadMessage

func (rf ReaderFunc) ReadMessage() (Message, error)

type Writer

type Writer interface {
	WriteMessage(Message) error
}

type WriterFunc

type WriterFunc func(Message) error

func (WriterFunc) WriteMessage

func (wf WriterFunc) WriteMessage(msg Message) error

Jump to

Keyboard shortcuts

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