Documentation ¶
Index ¶
- Variables
- func Authenticate(w http.ResponseWriter, r *http.Request) *models.Unit
- func CORS(next http.Handler) http.Handler
- func ERROR(w http.ResponseWriter, statusCode int, err error)
- func JSON(w http.ResponseWriter, statusCode int, data interface{})
- type API
- func (api *API) GetInbox(w http.ResponseWriter, r *http.Request)
- func (api *API) GetInboxMessage(w http.ResponseWriter, r *http.Request)
- func (api *API) InboxMessage(id int) (map[string]interface{}, int, error)
- func (api *API) ListUnits(w http.ResponseWriter, r *http.Request)
- func (api *API) MarkInboxMessage(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerGetData(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerGetInbox(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerGetInboxMessage(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerGetMemory(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerGetMemoryOf(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerGetMeshData(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerGetPeers(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerListUnits(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerMarkInboxMessage(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerReportAP(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerSendMessageTo(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerSetData(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerSetMeshData(w http.ResponseWriter, r *http.Request)
- func (api *API) PeerSetSignaling(w http.ResponseWriter, r *http.Request)
- func (api *API) Run(addr string)
- func (api *API) SendMessage(fingerprint string, cleartext []byte) (int, error)
- func (api *API) SendMessageTo(w http.ResponseWriter, r *http.Request)
- func (api *API) ShowUnit(w http.ResponseWriter, r *http.Request)
- func (api *API) UnitEnroll(w http.ResponseWriter, r *http.Request)
- func (api *API) UnitReportAP(w http.ResponseWriter, r *http.Request)
- func (api *API) UnitReportMultipleAP(w http.ResponseWriter, r *http.Request)
- func (api *API) UnitsByCountry(w http.ResponseWriter, r *http.Request)
- type Client
- func (c *Client) Data() map[string]interface{}
- func (c *Client) Get(path string, auth bool) (map[string]interface{}, error)
- func (c *Client) Inbox(page int) (map[string]interface{}, error)
- func (c *Client) InboxMessage(id int) (map[string]interface{}, error)
- func (c *Client) MarkInboxMessage(id int, mark string) (map[string]interface{}, error)
- func (c *Client) PagedUnits(page int) (map[string]interface{}, error)
- func (c *Client) Post(path string, what interface{}, auth bool) (map[string]interface{}, error)
- func (c *Client) ReportAP(report interface{}) (map[string]interface{}, error)
- func (c *Client) Request(method string, path string, data interface{}, auth bool) (map[string]interface{}, error)
- func (c *Client) SendMessageTo(fingerprint string, msg Message) error
- func (c *Client) SetData(newData map[string]interface{}) map[string]interface{}
- func (c *Client) Unit(fingerprint string) (map[string]interface{}, error)
- type Message
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTokenClaims = errors.New("can't extract claims from jwt token") ErrTokenInvalid = errors.New("jwt token not valid") ErrTokenExpired = errors.New("jwt token expired") ErrTokenIncomplete = errors.New("jwt token is missing required fields") )
View Source
var ( ClientTimeout = 60 ClientKeepalive = 30 ClientTokenFile = "/tmp/shikigrid-api-enrollment.json" Endpoint = "" )
View Source
var ( ErrEmptyMessage = errors.New("empty message body") ErrSenderNotFound = errors.New("sender not found") )
View Source
var ( ErrRecNotFound = errors.New("recipient not found") ErrMessageNotFound = errors.New("message not found") ErrInvalidKey = errors.New("invalid public key") ErrInvalidSignature = errors.New("can't verify signature") ErrDecoding = errors.New("error decoding data") )
View Source
var ( ErrEmpty = errors.New("") )
Functions ¶
func Authenticate ¶
func JSON ¶
func JSON(w http.ResponseWriter, statusCode int, data interface{})
Types ¶
type API ¶
type API struct { Router *chi.Mux Keys *crypto.KeyPair Peer *mesh.Peer Mesh *mesh.Router Client *Client }
func (*API) GetInboxMessage ¶
func (api *API) GetInboxMessage(w http.ResponseWriter, r *http.Request)
func (*API) InboxMessage ¶
func (*API) MarkInboxMessage ¶
func (api *API) MarkInboxMessage(w http.ResponseWriter, r *http.Request)
func (*API) PeerGetData ¶
func (api *API) PeerGetData(w http.ResponseWriter, r *http.Request)
PeerGetData GET /api/v1/data
func (*API) PeerGetInbox ¶
func (api *API) PeerGetInbox(w http.ResponseWriter, r *http.Request)
PeerGetInbox /api/v1/inbox/
func (*API) PeerGetInboxMessage ¶
func (api *API) PeerGetInboxMessage(w http.ResponseWriter, r *http.Request)
/api/v1/inbox/<msg_id>
func (*API) PeerGetMemory ¶
func (api *API) PeerGetMemory(w http.ResponseWriter, r *http.Request)
PeerGetMemory GET /api/v1/mesh/memory
func (*API) PeerGetMemoryOf ¶
func (api *API) PeerGetMemoryOf(w http.ResponseWriter, r *http.Request)
PeerGetMemoryOf GET /api/v1/mesh/memory/<fingerprint>
func (*API) PeerGetMeshData ¶
func (api *API) PeerGetMeshData(w http.ResponseWriter, r *http.Request)
PeerGetMeshData GET /api/v1/mesh/data
func (*API) PeerGetPeers ¶
func (api *API) PeerGetPeers(w http.ResponseWriter, r *http.Request)
PeerGetPeers GET /api/v1/mesh/peers
func (*API) PeerListUnits ¶
func (api *API) PeerListUnits(w http.ResponseWriter, r *http.Request)
func (*API) PeerMarkInboxMessage ¶
func (api *API) PeerMarkInboxMessage(w http.ResponseWriter, r *http.Request)
/api/v1/inbox/<msg_id>/<mark>
func (*API) PeerReportAP ¶
func (api *API) PeerReportAP(w http.ResponseWriter, r *http.Request)
PeerReportAP POST /api/v1/report/ap
func (*API) PeerSendMessageTo ¶
func (api *API) PeerSendMessageTo(w http.ResponseWriter, r *http.Request)
POST /api/v1/unit/<fingerprint>/inbox
func (*API) PeerSetData ¶
func (api *API) PeerSetData(w http.ResponseWriter, r *http.Request)
PeerSetData POST /api/v1/data
func (*API) PeerSetMeshData ¶
func (api *API) PeerSetMeshData(w http.ResponseWriter, r *http.Request)
PeerSetMeshData POST /api/v1/mesh/data
func (*API) PeerSetSignaling ¶
func (api *API) PeerSetSignaling(w http.ResponseWriter, r *http.Request)
PeerSetSignaling GET /api/v1/mesh/<status>
func (*API) SendMessage ¶
func (*API) SendMessageTo ¶
func (api *API) SendMessageTo(w http.ResponseWriter, r *http.Request)
func (*API) UnitEnroll ¶
func (api *API) UnitEnroll(w http.ResponseWriter, r *http.Request)
func (*API) UnitReportAP ¶
func (api *API) UnitReportAP(w http.ResponseWriter, r *http.Request)
func (*API) UnitReportMultipleAP ¶
func (api *API) UnitReportMultipleAP(w http.ResponseWriter, r *http.Request)
func (*API) UnitsByCountry ¶
func (api *API) UnitsByCountry(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.