Skip to content

Commit

Permalink
docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatczuk committed Feb 15, 2017
1 parent 8da19da commit e8fdccb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
2 changes: 1 addition & 1 deletion auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type Auth struct {
Password string
}

// NewAuth creates new auth from string representation.
// NewAuth creates new auth from string representation "user:password".
func NewAuth(auth string) *Auth {
if auth == "" {
return nil
Expand Down
18 changes: 9 additions & 9 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ type ClientConfig struct {
// DialTLS specifies an optional dial function that creates a tls
// connection to the server. If DialTLS is nil, tls.Dial is used.
DialTLS func(network, addr string, config *tls.Config) (net.Conn, error)
// Backoff specifies wait before retry policy when server ch fails.
// If nil when ch fails it would immediately return error.
// Backoff specifies backoff policy on server connection retry. If nil
// when dial fails it will not be retried.
Backoff Backoff
// Tunnels specifies tunnels client requests to be opened on server.
// Tunnels specifies the tunnels client requests to be opened on server.
Tunnels map[string]*proto.Tunnel
// Proxy is ProxyFunc responsible for transferring data between server
// and local services.
Proxy ProxyFunc
// Logger is optional logger. If nil no logs will be printed.
// Logger is optional logger. If nil logging is disabled.
Logger log.Logger
}

Expand Down Expand Up @@ -84,9 +84,10 @@ func NewClient(config *ClientConfig) *Client {
return c
}

// Start connects client to the server, it returns error if there is a dial
// error, otherwise it spawns a new goroutine with http/2 server handling
// ControlMessages.
// Start connects client to the server, it returns error if there is a
// connection error, or server cannot open requested tunnels. On connection
// error a backoff policy is used to reestablish the connection. When connected
// HTTP/2 server is started to handle ControlMessages.
func (c *Client) Start() error {
c.logger.Log(
"level", 1,
Expand Down Expand Up @@ -285,8 +286,7 @@ func (c *Client) handleHandshake(w http.ResponseWriter, r *http.Request) {
w.Write(b)
}

// Stop closes the connection between client and server. After stopping client
// can be started again.
// Stop disconnects client from server.
func (c *Client) Stop() {
c.connMu.Lock()
defer c.connMu.Unlock()
Expand Down
3 changes: 1 addition & 2 deletions httpproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ func NewHTTPProxy(localURL *url.URL, logger log.Logger) *HTTPProxy {
}

// NewMultiHTTPProxy creates a new dispatching HTTPProxy, requests may go to
// different backends based on localURLMap, see HTTPProxy localURLMap docs for
// more details.
// different backends based on localURLMap.
func NewMultiHTTPProxy(localURLMap map[string]*url.URL, logger log.Logger) *HTTPProxy {
if localURLMap == nil || len(localURLMap) == 0 {
panic("Empty localURLMap")
Expand Down
4 changes: 2 additions & 2 deletions log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ type Logger interface {
Log(keyvals ...interface{}) error
}

// Context is simplified version of
// [go-kit log Context](https://godoc.org/github.com/go-kit/kit/log#Context).
// Context is simplified version of go-kit log Context
// https://godoc.org/github.com/go-kit/kit/log#Context.
type Context struct {
prefix []interface{}
suffix []interface{}
Expand Down
9 changes: 5 additions & 4 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ import (

// ServerConfig defines configuration for the Server.
type ServerConfig struct {
// Addr is tcp address to listen on for client connections, ":0" if empty.
// Addr is TCP address to listen for client connections. If empty ":0"
// is used.
Addr string
// TLSConfig specifies the tls configuration to use with tls.Listener.
TLSConfig *tls.Config
// Listener specifies optional listener that clients would connect to.
// If Listener is nil tls.Listen("tcp", Addr, TLSConfig) is used.
// Listener specifies optional listener for client connections. If nil
// tls.Listen("tcp", Addr, TLSConfig) is used.
Listener net.Listener
// Logger is optional logger. If nil no logs will be printed.
// Logger is optional logger. If nil logging is disabled.
Logger log.Logger
}

Expand Down
3 changes: 1 addition & 2 deletions tcpproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ func NewTCPProxy(localAddr string, logger log.Logger) *TCPProxy {
}

// NewMultiTCPProxy creates a new dispatching TCPProxy, connections may go to
// different backends based on localAddrMap, see TCPProxy localAddrMap docs for
// more details.
// different backends based on localAddrMap.
func NewMultiTCPProxy(localAddrMap map[string]string, logger log.Logger) *TCPProxy {
if localAddrMap == nil || len(localAddrMap) == 0 {
panic("Empty localAddrMap")
Expand Down

0 comments on commit e8fdccb

Please sign in to comment.