reseed

package
v0.0.0-...-e7d4585 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2017 License: MIT Imports: 32 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTLSCertificate

func NewTLSCertificate(host string, priv *ecdsa.PrivateKey) ([]byte, error)

func SignerFilename

func SignerFilename(signer string) string

Types

type Blacklist

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

func NewBlacklist

func NewBlacklist() *Blacklist

func (*Blacklist) BlockIP

func (s *Blacklist) BlockIP(ip string)

func (*Blacklist) LoadFile

func (s *Blacklist) LoadFile(file string) error

type KeyStore

type KeyStore struct {
	Path string
}

func (*KeyStore) ReseederCertificate

func (ks *KeyStore) ReseederCertificate(signer []byte) (*x509.Certificate, error)

type LocalNetDbImpl

type LocalNetDbImpl struct {
	Path string
}

func NewLocalNetDb

func NewLocalNetDb(path string) *LocalNetDbImpl

func (*LocalNetDbImpl) RouterInfos

func (db *LocalNetDbImpl) RouterInfos() (routerInfos []routerInfo, err error)

type NetDbProvider

type NetDbProvider interface {
	// Get all router infos
	RouterInfos() ([]routerInfo, error)
}

type Peer

type Peer string

func (Peer) Hash

func (p Peer) Hash() int

type Reseeder

type Reseeder interface {
	// get an su3 file (bytes) for a peer
	PeerSu3Bytes(peer Peer) ([]byte, error)
}

type ReseederImpl

type ReseederImpl struct {
	SigningKey      *rsa.PrivateKey
	SignerID        []byte
	NumRi           int
	RebuildInterval time.Duration
	NumSu3          int
	// contains filtered or unexported fields
}

func NewReseeder

func NewReseeder(netdb NetDbProvider) *ReseederImpl

func (*ReseederImpl) PeerSu3Bytes

func (rs *ReseederImpl) PeerSu3Bytes(peer Peer) ([]byte, error)

func (*ReseederImpl) Start

func (rs *ReseederImpl) Start() chan bool

type Server

type Server struct {
	*http.Server
	Reseeder  Reseeder
	Blacklist *Blacklist
}

func NewServer

func NewServer(prefix string, trustProxy bool) *Server

func (*Server) ListenAndServe

func (srv *Server) ListenAndServe() error

func (*Server) ListenAndServeTLS

func (srv *Server) ListenAndServeTLS(certFile, keyFile string) error

Jump to

Keyboard shortcuts

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