Documentation
¶
Index ¶
- Constants
- Variables
- func Read(d FileData, path string) error
- func Write(d FileData, path string) error
- type ACL
- type Auth
- type ClientSession
- type Config
- func (c *Config) Decode(data []byte) error
- func (c *Config) Encode() ([]byte, error)
- func (c *Config) Fatal(values ...interface{})
- func (c *Config) Log(level log.LogLevel, values ...interface{})
- func (c *Config) NewClient()
- func (c *Config) NewServer()
- func (c *Config) StartLogging() error
- func (c *Config) StopLogging() error
- type DBSettings
- type FileData
- type Key
- type Message
- type Pool
- type Request
- type Runtime
- type Server
- type Session
- type Startup
- type StartupCrypto
- type User
- type X509
Constants ¶
const ( // Software versin Version = "0.1.0" // DefClientGID is the default client group ID DefClientGID = 1 // DefAdminGID is the default admin group ID DefAdminGID = 2 // SuperGID is the super group ID SuperGID = 3 )
const ( // Session ID header HdrSession = "Session-ID" // MAC header HdrMAC = "X-AUTH-MAC" // Session key header HdrKey = "X-AUTH-KEY" )
Header names
Variables ¶
var DefaultAdminPass = []byte("password")
Functions ¶
Types ¶
type ClientSession ¶
type Config ¶
type Config struct { Runtime Runtime // These are only used at runtime, and never saved to disk Startup Startup // These are stored in the config file DB gorm.DB // DB interface (only used in server mode) Session Session // Admin/Client transport data // contains filtered or unexported fields }
Root config object
func (*Config) Fatal ¶
func (c *Config) Fatal(values ...interface{})
Fatal is a wrapper around log.Fatal()
func (*Config) NewClient ¶
func (c *Config) NewClient()
NewClient allocations all objects used by the client.
func (*Config) NewServer ¶
func (c *Config) NewServer()
NewServer allocates all objects used by the server
func (*Config) StartLogging ¶
StartLogging is a wrapper around log.Start()
func (*Config) StopLogging ¶
StopLogging is a wrapper around log.Stop()
type DBSettings ¶
type Key ¶
type Key struct { Name string `json:",omitempty"` Client string `json:",omitempty"` Admin string `json:",omitempty"` Path string `json:",omitempty"` Key []byte `json:",omitempty"` Secret []byte `json:",omitempty"` UserKey []byte `json:",omitempty"` GroupPub []byte `json:",omitempty"` GroupPriv []byte `json:",omitempty"` }
type Message ¶
type Message struct { Key Key `json:",omitempty"` User User `json:",omitempty"` X509 X509 `json:"x509,omitempty"` Auth Auth `json:",omitempty"` Response string `json:",omitempty"` }
func RespMessage ¶
RespMessage creates a message with a given response string.
type Pool ¶
Pool is an interface for a session pool. It requires a Validate method, which verifies a Request.
type Request ¶
type Request struct { Req Message Session ClientSession // contains filtered or unexported fields }
func (*Request) Parse ¶
func (r *Request) Parse(body []byte, resp http.ResponseWriter) bool
New reads the request body and headers from the client request, and sets the response writer.
func (*Request) Reply ¶
Reply sends a response to a request. We never return anything, as there's no useful handling the server can do if our response fails.
func (*Request) SetSessionID ¶
type Runtime ¶
type Runtime struct { Log io.Writer Key *crypto.TLSKey Cert *crypto.TLSCert CAKey *crypto.TLSKey CACert *crypto.TLSCert CA *crypto.CertPool Keypair *crypto.Key ServerCert crypto.Binary Password crypto.Binary }
Runtime attributes. These should never be written to disk
type Session ¶
type Startup ¶
type Startup struct { Dir string // Directory where certs etc are stored NodeName string // Should be set to hostname for servers. Address string LogFile string LogLevel log.LogLevel Crypto StartupCrypto `toml:"files"` DB DBSettings `toml:"database"` }
Startup attributes. These can be written to the config file safely