Documentation
¶
Index ¶
- Constants
- type Handler
- type SecureConn
- func (sc *SecureConn) Close() error
- func (sc *SecureConn) LocalAddr() net.Addr
- func (sc *SecureConn) Read(b []byte) (int, error)
- func (sc *SecureConn) RemoteAddr() net.Addr
- func (sc *SecureConn) SetDeadline(t time.Time) error
- func (sc *SecureConn) SetReadDeadline(t time.Time) error
- func (sc *SecureConn) SetWriteDeadline(t time.Time) error
- func (sc *SecureConn) Write(b []byte) (int, error)
- type Server
Constants ¶
const HandshakeTimeout = 10 * time.Second
HandshakeTimeout is the maximum time allowed for the ECDH handshake.
const MaxEncryptedMessageLen = 16 * 1024 * 1024 // 16 MB
MaxEncryptedMessageLen limits the maximum decrypted message size to prevent memory exhaustion from a malicious peer advertising a huge msgLen.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SecureConn ¶
type SecureConn struct {
// contains filtered or unexported fields
}
SecureConn wraps a net.Conn with AES-256-GCM encryption. After a successful ECDH handshake, all reads and writes are encrypted.
func Dial ¶
Dial connects to a remote agent's secure port and performs the handshake. Returns an encrypted connection that implements net.Conn.
func Handshake ¶
func Handshake(conn net.Conn, isServer bool) (*SecureConn, error)
Handshake performs an ECDH key exchange over the connection. isServer determines which side reads first. A deadline is set to prevent indefinite blocking (M14 fix).
func (*SecureConn) Close ¶
func (sc *SecureConn) Close() error
func (*SecureConn) LocalAddr ¶
func (sc *SecureConn) LocalAddr() net.Addr
func (*SecureConn) Read ¶
func (sc *SecureConn) Read(b []byte) (int, error)
Read decrypts and reads data from the connection. Leftover plaintext from a previous decryption is returned first (H14 fix).
func (*SecureConn) RemoteAddr ¶
func (sc *SecureConn) RemoteAddr() net.Addr
func (*SecureConn) SetDeadline ¶
func (sc *SecureConn) SetDeadline(t time.Time) error
func (*SecureConn) SetReadDeadline ¶
func (sc *SecureConn) SetReadDeadline(t time.Time) error
func (*SecureConn) SetWriteDeadline ¶
func (sc *SecureConn) SetWriteDeadline(t time.Time) error
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server listens on port 443 and upgrades connections to encrypted channels.
func (*Server) ListenAndServe ¶
ListenAndServe binds port 443 and starts accepting secure connections.