plugin

package
v0.0.0-...-928a991 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package plugin is a Caddy HTTP plugin that implements the SSTP protocol. This requires pppd to bridge the connection through SSTP.

Index

Constants

View Source
const (
	HandshakeLengthOriginal = "Content-Length: 18446744073709551615"
	HandshakeLengthReplaced = "Content-Length: 9223372036854775807 "
)

The string to find and replace within SSTP handshakes.

View Source
const (
	MethodCheckString = "SSTP"
	MethodCheckLen    = len(MethodCheckString)
)

The string to verify from the start of the request, to check that it is a SSTP handshake.

View Source
const MethodSstp = "SSTP_DUPLEX_POST"

MethodSstp is the SSTP handshake's HTTP method.

View Source
const RequestPath = "/sra_{BA195980-CD49-458b-9E23-C84EE0ADCD75}/"

RequestPath is the path that the SSTP handshake uses.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeID

type AttributeID uint8

AttributeID is the type of attribute this attribute is

const (
	AttributeIDEncapsulatedProtocolID AttributeID = 1
	AttributeIDStatusInfo             AttributeID = 2
	AttributeIDCryptoBinding          AttributeID = 3
	AttributeIDCryptoBindingReq       AttributeID = 4
)

Constants for AttributeID values

func (AttributeID) String

func (k AttributeID) String() string

type Listener

type Listener struct {
	caddy.Listener
}

Listener is a wrapper around a caddy.Listener that modifies SSTP requests.

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

Accept is a wrapper around caddy.Listener.Accept() that intercepts the SSTP HTTP handshake.

type MessageType

type MessageType uint16

MessageType is the type of message this packet is

const (
	MessageTypeCallConnectRequest MessageType = 1
	MessageTypeCallConnectAck     MessageType = 2
	MessageTypeCallConnectNak     MessageType = 3
	MessageTypeCallConnected      MessageType = 4
	MessageTypeCallAbort          MessageType = 5
	MessageTypeCallDisconnect     MessageType = 6
	MessageTypeCallDisconnectAck  MessageType = 7
	MessageTypeEchoRequest        MessageType = 8
	MessageTypeEchoResponse       MessageType = 9
)

Constants for MessageType values

func (MessageType) String

func (k MessageType) String() string

type Server

type Server struct {
	NextHandler httpserver.Handler
	// contains filtered or unexported fields
}

Server is a httpserver.Handler that handles SSTP requests.

func (Server) ServeHTTP

func (s Server) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)

Serves SSTP requests. See httpserver.Handler.

type WrappedConn

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

WrappedConn is a wrapper around a net.Conn that modifies SSTP requests.

func (*WrappedConn) Read

func (c *WrappedConn) Read(b []byte) (int, error)

Overrides net.Conn.Read to modify SSTP requests.

This is needed as SSTP handshakes use a Content-Length greater than an int64, so it must be modified to be compatible.

This currently only works on HTTP requests, as we currently have no way intercept after SSL decryption.

This function is passive: it will not read more bytes than c.Conn.Read reads, and will modify them if it is needed.

Jump to

Keyboard shortcuts

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