Documentation ¶
Index ¶
- func Assets() *assets
- func AssetsSetDir(dir string) *assets
- func Dial(network, address string) (net.Conn, error)
- func EnableProxyProtocol()
- func Logger() *logrus.Logger
- func NewTapDanceConn() (net.Conn, error)
- func SetTlsLogFilename(filename string) error
- func WriteTlsLog(clientRandom, masterSecret []byte) error
- type CounterUint64
- type Dialer
- type DualConn
- type TapdanceFlowConn
- func (flowConn *TapdanceFlowConn) Close() error
- func (flowConn *TapdanceFlowConn) DialContext(ctx context.Context) error
- func (flowConn *TapdanceFlowConn) LocalAddr() net.Addr
- func (flowConn *TapdanceFlowConn) Read(b []byte) (int, error)
- func (flowConn *TapdanceFlowConn) RemoteAddr() net.Addr
- func (flowConn *TapdanceFlowConn) SetDeadline(t time.Time) error
- func (flowConn *TapdanceFlowConn) SetReadDeadline(t time.Time) error
- func (flowConn *TapdanceFlowConn) SetWriteDeadline(t time.Time) error
- func (flowConn *TapdanceFlowConn) Write(b []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Assets ¶
func Assets() *assets
Assets is an access point to asset managing singleton. First access to singleton sets path. Assets(), if called before SetAssetsDir() sets path to "./assets/"
func AssetsSetDir ¶
func AssetsSetDir(dir string) *assets
AssetsSetDir sets the directory to read assets from. Functionally equivalent to Assets() after initialization, unless dir changes.
func Dial ¶
Dial connects to the address on the named network.
The only supported network at this time: "tcp". The address has the form "host:port". The host must be a literal IP address, or a host name that can be resolved to IP addresses. To avoid abuse, only certain whitelisted ports are allowed.
Example: Dial("tcp", "golang.org:80")
func EnableProxyProtocol ¶
func EnableProxyProtocol()
Requests station to proxy client IP to upstream in following form: CONNECT 1.2.3.4:443 HTTP/1.1\r\n Host: 1.2.3.4\r\n \r\n PROXY TCP4 x.x.x.x 127.0.0.1 1111 1234\r\n
^__^ ^_____^ ^_________________^ proto clientIP garbage
func NewTapDanceConn ¶
NewTapDanceConn returns TapDance connection, that is ready to be Dial'd
func SetTlsLogFilename ¶
func WriteTlsLog ¶
Types ¶
type CounterUint64 ¶
CounterUint64 is a goroutine-safe uint64 counter. Wraps, if underflows/overflows.
func (*CounterUint64) Dec ¶
func (c *CounterUint64) Dec() uint64
Dec decrements the counter and returns resulting value
func (*CounterUint64) Get ¶
func (c *CounterUint64) Get() (value uint64)
Get returns current counter value
func (*CounterUint64) GetAndInc ¶
func (c *CounterUint64) GetAndInc() uint64
GetAndInc returns current value and then increases the counter
func (*CounterUint64) Inc ¶
func (c *CounterUint64) Inc() uint64
Inc increases the counter and returns resulting value
func (*CounterUint64) Set ¶
func (c *CounterUint64) Set(value uint64)
Set assigns current counter value
type Dialer ¶
type Dialer struct { SplitFlows bool TcpDialer func(context.Context, string, string) (net.Conn, error) }
Dialer contains options and implements advanced functions for establishing TapDance connection.
func (*Dialer) DialContext ¶
DialContext connects to the address on the named network using the provided context. Long deadline is strongly advised, since tapdance will try multiple decoys.
The only supported network at this time: "tcp". The address has the form "host:port". The host must be a literal IP address, or a host name that can be resolved to IP addresses. To avoid abuse, only certain whitelisted ports are allowed.
Example: Dial("tcp", "golang.org:80")
type DualConn ¶
DualConn is composed of 2 separate TapdanceFlowConn. Allows to achieve substantially higher upload speed and slightly higher download speed.
type TapdanceFlowConn ¶
type TapdanceFlowConn struct {
// contains filtered or unexported fields
}
TapdanceFlowConn represents single TapDance flow.
func (*TapdanceFlowConn) Close ¶
func (flowConn *TapdanceFlowConn) Close() error
Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.
func (*TapdanceFlowConn) DialContext ¶
func (flowConn *TapdanceFlowConn) DialContext(ctx context.Context) error
Dial establishes direct connection to TapDance station proxy. Users are expected to send HTTP CONNECT request next.
func (*TapdanceFlowConn) LocalAddr ¶
func (flowConn *TapdanceFlowConn) LocalAddr() net.Addr
LocalAddr returns the local network address.
func (*TapdanceFlowConn) RemoteAddr ¶
func (flowConn *TapdanceFlowConn) RemoteAddr() net.Addr
RemoteAddr returns the address of current decoy. Not goroutine-safe, mostly here to satisfy net.Conn
func (*TapdanceFlowConn) SetDeadline ¶
func (flowConn *TapdanceFlowConn) SetDeadline(t time.Time) error
SetDeadline is supposed to set the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.
TODO: In reality, SetDeadline doesn't do that yet, but existence of this function is mandatory to implement net.Conn
A deadline is an absolute time after which I/O operations fail with a timeout (see type Error) instead of blocking. The deadline applies to all future I/O, not just the immediately following call to Read or Write.
An idle timeout can be implemented by repeatedly extending the deadline after successful Read or Write calls.
A zero value for t means I/O operations will not time out.
func (*TapdanceFlowConn) SetReadDeadline ¶
func (flowConn *TapdanceFlowConn) SetReadDeadline(t time.Time) error
SetReadDeadline sets the deadline for future Read calls. A zero value for t means Read will not time out.
func (*TapdanceFlowConn) SetWriteDeadline ¶
func (flowConn *TapdanceFlowConn) SetWriteDeadline(t time.Time) error
SetWriteDeadline sets the deadline for future Write calls. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.