client

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = cli.Command{
	Name:  "connect",
	Usage: "connect to a server",
	Flags: []cli.Flag{
		cli.BoolFlag{
			Name:  "d, debug",
			Usage: "debug log level",
		},
		cli.StringFlag{
			Name:  "P, proto",
			Value: "tcp",
			Usage: "the proto between two points",
		},
		cli.StringFlag{
			Name:  "s, secret",
			Usage: "secret phrase",
		},
		cli.IntFlag{
			Name:  "keyiter",
			Usage: "key iter times for pbkdf2",
		},
		cli.IntFlag{
			Name:  "keylen",
			Usage: "key length for pbkdf2",
		},
		cli.StringSliceFlag{
			Name:  "t, tunnel",
			Usage: "new tunnel",
		},
		cli.IntFlag{
			Name:  "keepalive",
			Value: 30,
			Usage: "keepalive interval",
		},
	},
	Action: func(c *cli.Context) {
		if c.Bool("debug") {
			logrus.SetLevel(logrus.DebugLevel)
		}

		_client, err := newClient(c)
		if err != nil {
			logrus.Errorf("connect to server failed: %s", err)
			return
		}
		_client.Start()
	},
}

Command run connect command

Functions

func StartAESConnect

func StartAESConnect(addr string, secret []byte) (net.Conn, error)

StartAESConnect start connection to a aes server

func StartDefaultConnect

func StartDefaultConnect(addr string) (net.Conn, error)

StartDefaultConnect start connection to a default server

func StartTLSConnect

func StartTLSConnect(addr string, caFile string, certFile string, keyFile string) (net.Conn, error)

StartTLSConnect start connection to a tls server

Types

type Client

type Client struct {
	Proto string
	Type  string
	// contains filtered or unexported fields
}

Client define a client object

func (*Client) Start

func (client *Client) Start()

Start run a server

Jump to

Keyboard shortcuts

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