kontrol

package
v0.0.0-...-2c249d0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2014 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package kontrol provides an implementation for the name service kite. It can be queried to get the list of running kites.

Index

Constants

View Source
const (
	KontrolVersion    = "0.0.4"
	HeartbeatInterval = 5 * time.Second
	HeartbeatDelay    = 10 * time.Second
	KitesPrefix       = "/kites"
	TokenLeeway       = 1 * time.Minute
)

Variables

View Source
var (
	TokenTTL    = 48 * time.Hour
	DefaultPort = 4000
)

Functions

This section is empty.

Types

type Kontrol

type Kontrol struct {
	Kite *kite.Kite

	// etcd options
	Name         string   // Name of the etcd instance
	DataDir      string   // etcd data dir
	EtcdAddr     string   // The public host:port used for etcd server.
	EtcdBindAddr string   // The listening host:port used for etcd server.
	PeerAddr     string   // The public host:port used for peer communication.
	PeerBindAddr string   // The listening host:port used for peer communication.
	Peers        []string // other peers in cluster (must be peer address of other instances)

	// MachineAuthenticate is used to authenticate the request in the
	// "handleMachine" method.  The reason for a separate auth function is, the
	// request must not be authenticated because clients do not have a kite.key
	// before they register to this machine.
	MachineAuthenticate func(r *kite.Request) error
	// contains filtered or unexported fields
}

func New

func New(conf *config.Config, version, publicKey, privateKey string) *Kontrol

New creates a new kontrol instance with the given verson and config instance. Publickey is used for validating tokens and privateKey is used for signing tokens.

peers can be given nil if not running on cluster.

Public and private keys are RSA pem blocks that can be generated with the following command:

openssl genrsa -out testkey.pem 2048
openssl rsa -in testkey.pem -pubout > testkey_pub.pem

func (*Kontrol) AddAuthenticator

func (k *Kontrol) AddAuthenticator(keyType string, fn func(*kite.Request) error)

func (*Kontrol) ClearKites

func (k *Kontrol) ClearKites() error

ClearKites removes everything under "/kites" from etcd.

func (*Kontrol) Close

func (k *Kontrol) Close()

Close stops kontrol and closes all connections

func (*Kontrol) RegisterSelf

func (k *Kontrol) RegisterSelf() error

RegisterSelf registers this host and writes a key to ~/.kite/kite.key

func (*Kontrol) Run

func (k *Kontrol) Run()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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