ttlib

package module
v0.0.0-...-9764c47 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2015 License: MIT Imports: 19 Imported by: 0

README

ttlib

Simple TLS tunneling in Go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientConfigDir

func ClientConfigDir(baseDir string) string

func ClientConfigFile

func ClientConfigFile(baseDir, user string) string

func ClientPwdDir

func ClientPwdDir(baseDir string) string

func ClientPwdFile

func ClientPwdFile(baseDir, user string) string

func Dial

func Dial(configPath string) (*tls.Conn, error)

Dial is a wrapper for tls.Dial. It uses a configuration file containing the remote address, username, password, and certificate.

func GenerateKeyAndCert

func GenerateKeyAndCert(baseDir, host string) error

Function that generates certificates. Mostly coppied from http://golang.org/src/pkg/crypto/tls/generate_cert.go.

func LoadKeyAndCert

func LoadKeyAndCert(baseDir string) ([]byte, []byte, error)

LoadKeyAndCert reads the key and certificate files into memory and returns them in that order.

func RpcServeForever

func RpcServeForever(baseDir string, obj interface{}) error

func ServerCertPath

func ServerCertPath(baseDir string) string

func ServerConfigPath

func ServerConfigPath(baseDir string) string

func ServerKeyPath

func ServerKeyPath(baseDir string) string

Types

type ClientConfig

type ClientConfig struct {
	Host   string // The host address: <address>:<port>.
	User   string // The username for the client.
	Pwd    []byte // The user's password.
	CaCert []byte // The CA certificate.
}

ClientConfig: A configuration file for a client.

func LoadClientConfig

func LoadClientConfig(path string) (*ClientConfig, error)

Load: Load the client's configuration from the given path.

func (ClientConfig) Save

func (cc ClientConfig) Save(path string) error

Save: Save the client's configuration to the given path.

type PwdFile

type PwdFile struct {
	PwdHash []byte
}

PwdFile: A password file (on the server) for a client.

func LoadPwdFile

func LoadPwdFile(baseDir, user string) (*PwdFile, error)

LoadPwdFile: Load a password file for the given user.

func (PwdFile) Save

func (pf PwdFile) Save(baseDir, user string) error

Save: Save the password file for the given user.

type PwdHandler

type PwdHandler struct {
	// contains filtered or unexported fields
}

PwdHandler provides an interface for requesting user's passwords.

func NewPwdHandler

func NewPwdHandler(baseDir string) *PwdHandler

func (*PwdHandler) GetPwdHash

func (ph *PwdHandler) GetPwdHash(user string) ([]byte, error)

type RpcClient

type RpcClient struct {
	// contains filtered or unexported fields
}

Client: A wrapper for rpc.Client that performs automatic reconnects.

func RpcDial

func RpcDial(configPath string) *RpcClient

func (*RpcClient) Call

func (rc *RpcClient) Call(
	serviceMethod string, args interface{}, reply interface{}) error

func (*RpcClient) Close

func (rc *RpcClient) Close() error

type ServerConfig

type ServerConfig struct {
	ListenAddr string // The address to pass to Listen.
	PublicAddr string // The address to use to connect to the server.
}

ServerConfig: A configuration file for a server.

func LoadServerConfig

func LoadServerConfig(baseDir string) (*ServerConfig, error)

LoadServerConfig: Load the server's configuration from the given baseDir.

func (ServerConfig) Save

func (sc ServerConfig) Save(baseDir string) error

Save: Save the server's configuration to the given baseDir.

type TtListener

type TtListener struct {
	// contains filtered or unexported fields
}

func Listen

func Listen(baseDir string) (*TtListener, error)

Listen is a wrapper for tls.Listen.

func (*TtListener) Accept

func (ln *TtListener) Accept() (net.Conn, error)

Accept wrapper.

func (*TtListener) Addr

func (ln *TtListener) Addr() net.Addr

func (*TtListener) Close

func (ln *TtListener) Close() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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