| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 | package internetimport (	"crypto/tls"	"net")type ConnectionHandler func(Connection)type Reusable interface {	Reusable() bool	SetReusable(reuse bool)}type StreamConnectionType intconst (	StreamConnectionTypeRawTCP StreamConnectionType = 1	StreamConnectionTypeTCP    StreamConnectionType = 2	StreamConnectionTypeKCP    StreamConnectionType = 4)type StreamSecurityType intconst (	StreamSecurityTypeNone StreamSecurityType = 0	StreamSecurityTypeTLS  StreamSecurityType = 1)type TLSSettings struct {	Certs []tls.Certificate}func (this *TLSSettings) GetTLSConfig() *tls.Config {	config := &tls.Config{		InsecureSkipVerify: true,	}	config.Certificates = this.Certs	config.BuildNameToCertificate()	return config}type StreamSettings struct {	Type        StreamConnectionType	Security    StreamSecurityType	TLSSettings *TLSSettings}func (this *StreamSettings) IsCapableOf(streamType StreamConnectionType) bool {	return (this.Type & streamType) == streamType}type Connection interface {	net.Conn	Reusable}type SysFd interface {	SysFd() (int, error)}
 |