tuntox

package module
v0.0.0-...-ec44b74 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2021 License: MIT Imports: 9 Imported by: 0

README

Go-Tuntox


go-tuntox is a simple wrapper around tuntox with a go-like interface

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	io.ReadCloser
	io.WriteCloser
	Command    *exec.Cmd
	RemotePort string
	RemoteAddr string
	ToxID      string
}

Type Client stores the running tuntox command created by Dial, the remote port being tunneled, the remote IP address being tunneled, the Tox ID of the server, and a Reader and Writer to provide input and output to the command, and therefore the connection

func Dial

func Dial(toxID, address string, password *string) (*Client, error)

Dial runs a command to connect to a tuntox server, returning a Client

func (Client) Close

func (client Client) Close() error

Close closes the readers and writers of the running process created by Dial and then kills the process

type Server

type Server struct {
	ToxID     string
	Command   *exec.Cmd
	WaitGroup *errgroup.Group
}

Type Server stores the running tuntox command started by Listen, its Tox ID, and an errgroup in case there is a need to wait for the server

func Listen

func Listen(password *string) (*Server, error)

Listen creates a new Server and runs the tuntox command, retrieving the Tox ID.

func (Server) Close

func (server Server) Close() error

Close stops the tuntox server by killing the previously started process

Jump to

Keyboard shortcuts

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