socketace

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestMethod          = "X-SOCKETACE"
	AcceptsProtocolVersion = "Accepts-Protocol-Version"
	UserAgent              = "User-Agent"
	Status                 = "Status"
	Capabilities           = "Capabilities"
	CapabilityStartTls     = "StartTLS"
	SecurityUnderlying     = "underlying"
	SecurityNone           = "none"
	SecurityTls            = "tls"
)

Variables

View Source
var SupportedProtocolVersions = []string{

	version.ProtocolVersion,
}

Functions

This section is empty.

Types

type ClientConnection

type ClientConnection struct {
	streams.Connection
	ServerVersion string
	// contains filtered or unexported fields
}

ClientConnection represents a client to the socketace server. It announces the client to the server, checks the server and establishes the connection.

func NewClientConnection

func NewClientConnection(c net.Conn, manager cert.TlsConfig, secure bool, host string) (*ClientConnection, error)

NewClientConnection will create a connection and negotiate the protocol and TLS security

func (*ClientConnection) Secure

func (cc *ClientConnection) Secure() bool

Secure will return `true` is security has been enabled for this connection (either by encrypting the whole channel or by starting encryption using `StartTLS`

func (*ClientConnection) SecurityTech

func (cc *ClientConnection) SecurityTech() string

func (*ClientConnection) String

func (cc *ClientConnection) String() string

type Request

type Request struct {
	Method  string // e.g. "X-SOCKETACE"
	URL     string // e.g. "/"
	Proto   string // e.g. "HTTP/1.0"
	Headers textproto.MIMEHeader
}

func (*Request) Read

func (sar *Request) Read(c *bufio.Reader) error

Read will write a SocketAce command and MIME headers from the stream.

func (*Request) String

func (sar *Request) String() string

func (*Request) Write

func (sar *Request) Write(c io.Writer) error

Write will write a SocketAce command and MIME headers to the stream.

type Response

type Response struct {
	Status     string // e.g. "200 OK"
	StatusCode int    // e.g. 200
	Proto      string // e.g. "HTTP/1.1"
	Headers    textproto.MIMEHeader
}

func (*Response) Read

func (sar *Response) Read(c *bufio.Reader) error

Read will write a SocketAce command and MIME headers from the stream.

func (*Response) String

func (sar *Response) String() string

func (*Response) Write

func (sar *Response) Write(c io.Writer) error

Write will write a SocketAce command and MIME headers to the stream.

type ServerConnection

type ServerConnection struct {
	streams.Connection
	ClientVersion string
	// contains filtered or unexported fields
}

ServerConnection represents the server part of this app. It waits for the client announcement checks if versions match and disconnects it it can't establish a connection

func NewServerConnection

func NewServerConnection(c net.Conn, manager cert.TlsConfig, secure bool) (*ServerConnection, error)

NewProxyWrapperServer will wait for client request and negotiate protocol version

func (*ServerConnection) Secure

func (sc *ServerConnection) Secure() bool

Secure will return `true` is security has been enabled for this connection (either by encrypting the whole channel or by starting encryption using `StartTLS`

func (*ServerConnection) SecurityTech

func (sc *ServerConnection) SecurityTech() string

func (*ServerConnection) String

func (sc *ServerConnection) String() string

Jump to

Keyboard shortcuts

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