meekserver

package module
v2.2.22 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package meekserver 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.

Package meekserver provides an implementation of the Meek circumvention protocol. Only a client implementation is provided, and no effort is made to normalize the TLS fingerprint.

It borrows quite liberally from the real meek-client code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMeekServerConnection

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

NewMeekServerConnection initializes the server connection

Types

type Config added in v2.1.11

type Config struct {
	AcmeEmail    string `json:"acme-email"`
	AcmeHostname string `json:"acme-hostnames"`
}

Config contains arguments formatted for a json file

type MeekServer

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

MeekServer is a Transport that uses domain fronting to shapeshift the application network traffic

func NewMeekTransportServer

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

NewMeekTransportServer is a public initializer method to get a new meek transport

func (*MeekServer) Listen

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

Listen on the meek transport does not have a corresponding server, only a client

type Session

type Session struct {
	Or       fakeConn
	LastSeen time.Time
}

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

IsExpired finds out if this session is old enough to be culled

func (*Session) Touch

func (session *Session) Touch()

Touch marks a session as having been seen just now.

type State

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

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

func NewState

func NewState() *State

NewState makes a new state

func (*State) CloseSession

func (state *State) CloseSession(sessionID string)

CloseSession removes 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()

ExpireSessions prevents an endless loop, checking for expired sessions and removing them.

func (*State) Get

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

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

func (*State) GetSession

func (state *State) GetSession(sessionID string) (*Session, error)

GetSession looks 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)

Post handles 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