Cloak/internal/server/transport.go

17 lines
455 B
Go
Raw Normal View History

2019-09-01 19:23:45 +00:00
package server
import (
2020-01-22 18:37:01 +00:00
"crypto"
"errors"
2020-04-09 21:11:12 +00:00
"io"
2019-09-01 19:23:45 +00:00
"net"
)
2020-04-09 21:11:12 +00:00
type Responder = func(originalConn net.Conn, sessionKey [32]byte, randSource io.Reader) (preparedConn net.Conn, err error)
2019-09-01 19:23:45 +00:00
type Transport interface {
2020-04-06 14:24:18 +00:00
processFirstPacket(reqPacket []byte, privateKey crypto.PrivateKey) (authFragments, Responder, error)
2019-09-01 19:23:45 +00:00
}
2020-01-22 18:37:01 +00:00
var ErrInvalidPubKey = errors.New("public key has invalid format")
var ErrCiphertextLength = errors.New("ciphertext has the wrong length")