core

package
v0.0.0-...-40f201c Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2021 License: Apache-2.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AEADList = map[string]struct {
	KeySize int
	New     func([]byte) (shadowaead.Cipher, error)
}{
	"AES-128-GCM":             {16, shadowaead.AESGCM},
	"AES-192-GCM":             {24, shadowaead.AESGCM},
	"AES-256-GCM":             {32, shadowaead.AESGCM},
	"CHACHA20-IETF-POLY1305":  {32, shadowaead.Chacha20Poly1305},
	"XCHACHA20-IETF-POLY1305": {32, shadowaead.XChacha20Poly1305},
}
View Source
var ErrCipherNotSupported = errors.New("Cipher not supported")
View Source
var StreamList = map[string]struct {
	KeySize int
	New     func([]byte) (shadowstream.Cipher, error)
}{
	"RC4-MD5":       {16, shadowstream.RC4MD5},
	"AES-128-CFB":   {16, shadowstream.AESCFB},
	"AES-192-CFB":   {24, shadowstream.AESCFB},
	"AES-256-CFB":   {32, shadowstream.AESCFB},
	"AES-128-CTR":   {16, shadowstream.AESCTR},
	"AES-192-CTR":   {24, shadowstream.AESCTR},
	"AES-256-CTR":   {32, shadowstream.AESCTR},
	"CHACHA20":      {32, shadowstream.Chacha20},
	"CHACHA20-IETF": {32, shadowstream.Chacha20IETF},
	"XCHACHA20":     {32, shadowstream.Xchacha20},
}

Functions

func Dial

func Dial(network, address string, cipher StreamConnCipher) (net.Conn, error)

func KDF

func KDF(s string, length int) []byte

func ListCipher

func ListCipher() []string

func Listen

func Listen(network, address string, cipher StreamConnCipher) (net.Listener, error)

func ListenPacket

func ListenPacket(network, address string, cipher PacketConnCipher) (net.PacketConn, error)

Types

type AEADCipher

type AEADCipher struct {
	shadowaead.Cipher

	Secret []byte
}

func (*AEADCipher) PacketConn

func (a *AEADCipher) PacketConn(c net.PacketConn) net.PacketConn

func (*AEADCipher) StreamConn

func (a *AEADCipher) StreamConn(c net.Conn) net.Conn

type Cipher

type Cipher interface {
	StreamConnCipher
	PacketConnCipher
}

func PickCipher

func PickCipher(name string, key []byte, password string) (Cipher, error)

type Listener

type Listener struct {
	net.Listener
	StreamConnCipher
}

func (*Listener) Accept

func (s *Listener) Accept() (net.Conn, error)

type PacketConnCipher

type PacketConnCipher interface {
	PacketConn(net.PacketConn) net.PacketConn
}

type StreamCipher

type StreamCipher struct {
	shadowstream.Cipher

	Secret []byte
}

func (*StreamCipher) PacketConn

func (s *StreamCipher) PacketConn(c net.PacketConn) net.PacketConn

func (*StreamCipher) StreamConn

func (s *StreamCipher) StreamConn(c net.Conn) net.Conn

type StreamConnCipher

type StreamConnCipher interface {
	StreamConn(net.Conn) net.Conn
}

Jump to

Keyboard shortcuts

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