meekserver

package module
v0.0.0-...-cac72fb Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2020 License: BSD-2-Clause, BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Overview

meek-server is the server transport plugin for the meek pluggable transport. It acts as an HTTP server, keeps track of session ids, and forwards received data to a local OR port.

Sample usage in torrc:

ServerTransportListenAddr meek 0.0.0.0:443
ServerTransportPlugin meek exec ./meek-server --acme-hostnames meek-server.example --acme-email admin@meek-server.example --log meek-server.log

Using your own TLS certificate:

ServerTransportListenAddr meek 0.0.0.0:8443
ServerTransportPlugin meek exec ./meek-server --cert cert.pem --key key.pem --log meek-server.log

Plain HTTP usage:

ServerTransportListenAddr meek 0.0.0.0:8080
ServerTransportPlugin meek exec ./meek-server --disable-tls --log meek-server.log

The server runs in HTTPS mode by default, getting certificates from Let's Encrypt automatically. The server opens an auxiliary ACME listener on port 80 in order for the automatic certificates to work. If you have your own certificate, use the --cert and --key options. Use --disable-tls option to run with plain HTTP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMeekServerConnection

func NewMeekServerConnection(state *State, sessionID string) net.Conn

Types

type MeekServer

type MeekServer struct {
	DisableTLS   bool
	AcmeEmail    string
	AcmeHostname string
	CertManager  *autocert.Manager
}

Transport that uses domain fronting to shapeshift the application network traffic

func NewMeekTransportServer

func NewMeekTransportServer(disableTLS bool, acmeEmail string, acmeHostnamesCommas string, stateDir string) *MeekServer

func (*MeekServer) Listen

func (transport *MeekServer) Listen(address string) net.Listener

The meek transport does not have a corresponding server, only a client

type Session

type Session struct {
	Or       fakeConn
	LastSeen time.Time
}

Every session id maps to an existing OR port connection, which we keep open between received requests. The first time we see a new session id, we create a new OR port connection.

func (*Session) IsExpired

func (session *Session) IsExpired() bool

Is this session old enough to be culled?

func (*Session) Touch

func (session *Session) Touch()

Mark a session as having been seen just now.

type State

type State struct {
	// contains filtered or unexported fields
}

There is one state per HTTP listener. In the usual case there is just one listener, so there is just one global state. State also serves as the http Handler.

func NewState

func NewState() *State

func (*State) CloseSession

func (state *State) CloseSession(sessionID string)

Remove a session from the map and closes its corresponding OR port connection. Does nothing if the session id is not known.

func (*State) ExpireSessions

func (state *State) ExpireSessions()

Loop forever, checking for expired sessions and removing them.

func (*State) Get

func (state *State) Get(w http.ResponseWriter, req *http.Request)

Handle a GET request. This doesn't have any purpose apart from diagnostics.

func (*State) GetSession

func (state *State) GetSession(sessionID string, req *http.Request) (*Session, error)

Look up a session by id, or create a new one (with its OR port connection) if it doesn't already exist.

func (*State) Post

func (state *State) Post(w http.ResponseWriter, req *http.Request)

Handle a POST request. Look up the session id and then do a transaction.

func (*State) ServeHTTP

func (state *State) ServeHTTP(w http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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