diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | doc/obfs4proxy.1 | 9 | ||||
-rw-r--r-- | transports/obfs4/statefile.go | 38 |
3 files changed, 46 insertions, 4 deletions
@@ -1,4 +1,7 @@ Changes in version 0.0.2 - UNRELEASED + - Write an example client bridge line suitable for use with the running obfs4 + server instance to "obfs4_bridgeline.txt" for the convenience of bridge + operators. - Add a man page for obfs4proxy. Changes in version 0.0.1 - 2014-09-03 diff --git a/doc/obfs4proxy.1 b/doc/obfs4proxy.1 index bda677a..e442946 100644 --- a/doc/obfs4proxy.1 +++ b/doc/obfs4proxy.1 @@ -1,4 +1,4 @@ -.TH OBFS4PROXY 1 "2014-09-06" +.TH OBFS4PROXY 1 "2014-09-24" .SH NAME obfs4proxy \- pluggable transport proxy for Tor, implementing obfs4 .SH SYNOPSIS @@ -53,6 +53,13 @@ The Bridge (server) auto-generated obfs4 bridge parameters file. This file will not be created if the administrator specifies them in the \fBtorrc\fR via a \fBServerTransportOptions\fR directive. .RE +.PP +\fIDataDirectory\fR\fB/pt_state/obfs4_bridgeline.txt\fR +.RS 4 +The Bridge (server) obfs4 bridge's client parameters. This file is created +and contains the \fBBridge\fR directive a client should add to their +\fBtorrc\fR to connect to the running server's obfs4 instance. +.RE .SH "CONFORMING TO" Tor Pluggable Transport Specification .SH NOTES diff --git a/transports/obfs4/statefile.go b/transports/obfs4/statefile.go index 8690178..1e00f32 100644 --- a/transports/obfs4/statefile.go +++ b/transports/obfs4/statefile.go @@ -42,7 +42,8 @@ import ( ) const ( - stateFile = "obfs4_state.json" + stateFile = "obfs4_state.json" + bridgeFile = "obfs4_bridgeline.txt" ) type jsonServerState struct { @@ -91,10 +92,10 @@ func serverStateFromArgs(stateDir string, args *pt.Args) (*obfs4ServerState, err js.IATMode = iatMode } - return serverStateFromJSONServerState(&js) + return serverStateFromJSONServerState(stateDir, &js) } -func serverStateFromJSONServerState(js *jsonServerState) (*obfs4ServerState, error) { +func serverStateFromJSONServerState(stateDir string, js *jsonServerState) (*obfs4ServerState, error) { var err error st := new(obfs4ServerState) @@ -112,6 +113,11 @@ func serverStateFromJSONServerState(js *jsonServerState) (*obfs4ServerState, err } st.iatMode = js.IATMode + // Generate a human readable summary of the configured endpoint. + if err = newBridgeFile(stateDir, st); err != nil { + return nil, err + } + return st, nil } @@ -170,3 +176,29 @@ func newJSONServerState(stateDir string, js *jsonServerState) (err error) { return nil } + +func newBridgeFile(stateDir string, st *obfs4ServerState) (err error) { + const prefix = "# obfs4 torrc client bridge line\n" + + "#\n" + + "# This file is an automatically generated bridge line based on\n" + + "# the current obfs4proxy configuration. EDITING IT WILL HAVE\n" + + "# NO EFFECT.\n" + + "#\n" + + "# Before distributing this Bridge, edit the placeholder fields\n" + + "# to contain the actual values:\n" + + "# <IP ADDRESS> - The public IP address of your obfs4 bridge.\n" + + "# <PORT> - The TCP/IP port of your obfs4 bridge.\n" + + "# <FINGERPRINT> - The bridge's fingerprint.\n\n" + + bridgeLine := fmt.Sprintf("Bridge obfs4 <IP ADDRESS>:<PORT> <FINGERPRINT> node-id=%s public-key=%s iat-mode=%d\n", + st.nodeID.Hex(), + st.identityKey.Public().Hex(), + st.iatMode) + + tmp := []byte(prefix + bridgeLine) + if err = ioutil.WriteFile(path.Join(stateDir, bridgeFile), tmp, 0600); err != nil { + return err + } + + return nil +} |