Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Handlers that will be called for internall routing after de/encryption Handlers []SecRESTHandler // Auth handler Auth SecRESTAuth // SERVER public key, armored PubKey string // SERVER private key, armored PrivKey string // Password for SERVER private key KeyPass string // AuthClients is intentionally made non-persistent, expires all clients on reboot. // This however is open for debate. AuthClients = make(map[string]string) )
Functions ¶
func StartRouter ¶
func StartRouter(port string, pubKey string, privKey string, keyPass string, handlers []SecRESTHandler, auth SecRESTAuth)
StartRouter accepts a Port string, and a slice of SecRESTHandler
then starts the router.
Types ¶
type SecRESTAuth ¶
type SecRESTAuth struct { // Handle Authentication for new client Run func(w http.ResponseWriter, r *http.Request) (bool, SecRESTAuthRequest) }
SecRESTAuth struct is for authenticating a client, and storing their PGP key
type SecRESTAuthRequest ¶
type SecRESTAuthRequest struct {
ClientKey string `json:"ClientKey"`
}
type SecRESTAuthResponse ¶
type SecRESTHandler ¶
type SecRESTHandler struct { Path string Insecure bool Body string Run func(SecRESTRequest) SecRESTResponse }
Struct for handlers, Insecure = True allows /insecure access
type SecRESTRequest ¶
type SecRESTRequest struct { Path string `json:"Path"` Body string `json:"Body"` ClientIdentifier string `json:"ClientIdentifier"` Insecure bool TimeStamp time.Time `json:"TimeStamp"` AuthRequest SecRESTAuthRequest `json:"AuthRequest"` }
SecRESTRequest is a decrypted request coming in from a client
type SecRESTResponse ¶
type SecRESTResponse struct { Status int `json:"Status"` Body string `json:"Body"` Ellapsed string `json:"Ellapsed"` AuthResponse SecRESTAuthResponse `json:"AuthResponse"` }
SecRESTResponse is a decrypted response to be sent to the client Will be encrypted if request.Insecure = false
Click to show internal directories.
Click to hide internal directories.