server

package
v0.0.0-...-a378f68 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2014 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Network    string
	Address    string
	Database   int
	Connection redis.Client
}

func (*DB) Connect

func (db *DB) Connect() (*redis.Client, error)

type Ident

type Ident struct {
	Signature   string `json:"signature"`
	Hostname    string `json:"hostname"`
	DisplayName string `json:"display_name"`
}

func CreateIdentity

func CreateIdentity(signature string, hostname string, display_name string) Ident

func GetOrCreateIdentity

func GetOrCreateIdentity(filename string) (Ident, error)

func LoadIdentity

func LoadIdentity(filename string) (Ident, error)

func NewIdentFromReader

func NewIdentFromReader(reader io.Reader) (Ident, error)

func NewIdentFromString

func NewIdentFromString(s string) (Ident, error)

func SaveIdentity

func SaveIdentity(identity Ident, filename string) (Ident, error)

func SaveIdentityFile

func SaveIdentityFile(identity Ident, file *os.File) (Ident, error)

func (*Ident) ToJson

func (i *Ident) ToJson() ([]byte, error)

func (*Ident) ToString

func (i *Ident) ToString() (string, error)

type Server

type Server struct {
	Identity Ident
	Db       *DB
}

func (*Server) DeleteIdent

func (s *Server) DeleteIdent(db *redis.Client, signature string) (Ident, error)

func (*Server) DeleteNodeIdentity

func (s *Server) DeleteNodeIdentity(response http.ResponseWriter, request *http.Request, db *redis.Client, params martini.Params) (int, string)

func (*Server) GetIdent

func (s *Server) GetIdent(db *redis.Client, signature string) (Ident, error)

func (*Server) GetIdentIndex

func (s *Server) GetIdentIndex(db *redis.Client, start int, stop int) ([]Ident, error)

func (*Server) GetNodeIdentity

func (s *Server) GetNodeIdentity(response http.ResponseWriter, request *http.Request, db *redis.Client, params martini.Params) (int, string)

func (*Server) GetNodeIdentityIndex

func (s *Server) GetNodeIdentityIndex(response http.ResponseWriter, request *http.Request, db *redis.Client, params martini.Params) (int, string)

func (*Server) GetOwnIdentity

func (s *Server) GetOwnIdentity(response http.ResponseWriter, request *http.Request) (int, string)

func (*Server) Handler

func (s *Server) Handler() martini.Handler

func (*Server) New

func (s *Server) New() *martini.ClassicMartini

func (*Server) PutIdent

func (s *Server) PutIdent(db *redis.Client, identity Ident) (Ident, error)

func (*Server) PutNodeIdentity

func (s *Server) PutNodeIdentity(response http.ResponseWriter, request *http.Request, db *redis.Client, params martini.Params) (int, string)

Jump to

Keyboard shortcuts

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