Documentation ¶
Overview ¶
package tlshowdy contains a number of utilities all designed to implement one primary method, Peek, which allows for simple implementations of virtual host demultiplexing using SNI.
Index ¶
Constants ¶
const PrefixLength = 1
PrefixLength is the number of bytes required to determine if the connection is a TLS connection.
Variables ¶
This section is empty.
Functions ¶
func PrefixIsTLS ¶
PrefixIsTLS will return if an incoming connection is, in fact, likely to be a TLS connection.
func ReadHandshake ¶
ReadHandshake reads an incoming TLS handshake message
Types ¶
type ClientHelloMsg ¶
type ClientHelloMsg struct { Vers uint16 Random []byte SessionId []byte CipherSuites []uint16 CompressionMethods []uint8 NextProtoNeg bool ServerName string SupportedPoints []uint8 TicketSupported bool SessionTicket []uint8 ALPNProtocols []string }
ClientHelloMsg is a Go struct version of the TLS client hello message.
func Peek ¶
Peek takes a net.Conn and reads a TLS client hello message if possible. The returned conn is a net.Conn that has whatever Peek read during processing placed back at the front of the read stream. If no client hello was detected but no other read error occurred, a nil ClientHelloMsg will be returned.
func Read ¶
func Read(r io.Reader) (msg *ClientHelloMsg, err error)
Read reads a full TLS client hello
func (*ClientHelloMsg) Marshal ¶
func (m *ClientHelloMsg) Marshal() []byte
func (*ClientHelloMsg) Unmarshal ¶
func (m *ClientHelloMsg) Unmarshal(data []byte) bool
type PrefixConn ¶
PrefixConn wraps a net.Conn but attaches a prefixed amount of data to the incoming side. This is used by Peek to replace consumed data.
func NewPrefixConn ¶
func NewPrefixConn(prefix []byte, conn net.Conn) *PrefixConn
func (*PrefixConn) UnderlyingConn ¶
func (c *PrefixConn) UnderlyingConn() net.Conn
type RecordingReader ¶
type RecordingReader struct { Received []byte // contains filtered or unexported fields }
RecordingReader wraps another io.Reader but keeps track of what it has read so far.
func NewRecordingReader ¶
func NewRecordingReader(r io.Reader) *RecordingReader