maybetls

package
v0.0.0-...-7279c54 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2013 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package maybetls implements a net.Listener wrapper that handles both secure (TLS) and insecure (cleartext) connections.

The heuristic is very simple: the first byte of the stream is read. If it is ASCII SYN (22 dec, 0x16 hex), the connection is wrapped by crypto/tls.Server. Otherwise, the connection is returned as-is. The connection is always wrapped to allow re-reading of the first byte.

This package will not work if the first byte a client sends can be ASCII SYN in the cleartext protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Conn

func Conn(c net.Conn, config *tls.Config) (net.Conn, error)

Conn returns a net.Conn that is wrapped by the crypto/tls.Server function if a heursitic is satisfied. See the package documentation for more details.

func Listener

func Listener(ln net.Listener, config *tls.Config) net.Listener

Listener returns a net.Listener that calls the Conn function in this package on accepted connections.

Types

This section is empty.

Jump to

Keyboard shortcuts

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