route/doc/api.md

1.7 KiB

API calls

Host Management

type HostKind int

const (
  KindHTTP HostKind = iota
  KindTCP
  KindIRC
  KindProxy
)

type Host struct {
  ID            string `gorethink:"id,omitempty"`
  Hostname      string `gorethink:"hostname"`
  OnionHostname string `gorethink:"onionhostname"`
  Token         string `gorethink:"token"`
  OnionKey      []byte `gorethink:"onionKey" json:"-"` // PEM-encoded

  Kind HostKind `gorethink:"hostKind"`
  Port string `gorethink:"port"`

  AllowedUsers []string `gorethink:"allowedUsers"`
}

AddHost

This creates a new host in the routing mesh.

type AddHostRequest struct {
  BaseAPICall
  Hostname string
  OnionKey *rsa.PrivateKey
}

type AddHostResponse struct {
  ID            string
  Token         string // JWT
  Hostname      string
  OnionHostname string
}

GetHost

ModifyHost

Token Management

type Token struct {
  ID string `gorethink:"id,omitempty" json:"jti"`

  ExpiresAt int64  `json:"exp,omitempty"`
  IssuedAt  int64  `json:"iat,omitempty"`
  Issuer    string `json:"iss,omitempty"`
  Subject   string `json:"sub,omitempty"`

  Revoked bool
  RevocationID string
  Scopes []string `json:"scopes"`
}

CreateInitialToken

ValidateToken

CreateToken

ListTokens

RevokeToken

Metrics

Report

Returns the following data for the last minute, the last 5 minutes and the last 10 minutes:

  • Number of requests processed
  • Total request latency
  • Longest request latency
  • Shortest request latency

Users

type User struct {
  ID string `gorethink:"id,omitempty"`
  Email string `gorethink:"email"`
  OauthMethod string `gorethink:"oauthMethod"`
}