optionaltls

package
v0.0.0-...-81c4703 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const TLSPeekedBytes = 6

Variables

This section is empty.

Functions

func DetectTLS

func DetectTLS(r io.Reader) (bool, []byte, error)

DetectTLS reads necessary number of bytes from io.Reader returns result, bytes read from Reader and error No matter if error happens or what flag value is returned bytes should be checked

func NewWrappedConn

func NewWrappedConn(conn net.Conn, peeked []byte) net.Conn

Types

type DynamicOption

type DynamicOption interface {
	IsActive() bool
}

DynamicOption controls optional TLS in runtime. It can be used to turn on/off the feature based on some condition For example, an atomic boolean flag

type DynamicOptionFunc

type DynamicOptionFunc func() bool

func (DynamicOptionFunc) IsActive

func (f DynamicOptionFunc) IsActive() bool

type WrappedConn

type WrappedConn struct {
	net.Conn
	// contains filtered or unexported fields
}

WrappedConn Imitates MSG_PEEK behaviour Unlike net.Conn is not thread-safe

func (*WrappedConn) Read

func (wc *WrappedConn) Read(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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