remove old api docs
This commit is contained in:
parent
36786956dc
commit
7a3757933d
|
@ -1,9 +0,0 @@
|
|||
// gopreload.go
|
||||
package main
|
||||
|
||||
/*
|
||||
This file is separate to make it very easy to both add into an application, but
|
||||
also very easy to remove.
|
||||
*/
|
||||
|
||||
import _ "github.com/Xe/gopreload"
|
|
@ -1,38 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/kr/pretty"
|
||||
"go.uber.org/atomic"
|
||||
)
|
||||
|
||||
var (
|
||||
port = flag.String("port", "9090", "HTTP port to listen on")
|
||||
|
||||
hits *atomic.Int64
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
hits = atomic.NewInt64(0)
|
||||
http.ListenAndServe(":"+*port, http.HandlerFunc(handle))
|
||||
}
|
||||
|
||||
func handle(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Fprintln(w, "Route is go!")
|
||||
fmt.Fprintf(w, "%s\n", pretty.Sprintf("%s", r.Header))
|
||||
hn, _ := os.Hostname()
|
||||
fmt.Fprintf(w, "Served by %s running %s\n", hn, runtime.GOOS)
|
||||
fmt.Fprintf(w, "Hit count: %d", hits.Inc())
|
||||
|
||||
ip := r.Header.Get("X-Remote-Ip")
|
||||
if ip != "" {
|
||||
log.Printf("Hit from %s: %s", ip, r.RequestURI)
|
||||
}
|
||||
}
|
115
doc/api.md
115
doc/api.md
|
@ -1,115 +0,0 @@
|
|||
API calls
|
||||
=========
|
||||
|
||||
Host Management
|
||||
---------------
|
||||
|
||||
```go
|
||||
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.
|
||||
|
||||
```go
|
||||
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
|
||||
----------------
|
||||
|
||||
```go
|
||||
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
|
||||
-----
|
||||
|
||||
```go
|
||||
type User struct {
|
||||
ID string `gorethink:"id,omitempty"`
|
||||
Email string `gorethink:"email"`
|
||||
OauthMethod string `gorethink:"oauthMethod"`
|
||||
IsAdmin bool `gorethink:"isADmin"`
|
||||
}
|
||||
```
|
||||
|
||||
### Login
|
||||
|
||||
### Logout
|
||||
|
||||
### Promote
|
||||
|
||||
### Demote
|
||||
|
||||
### AddNewLoginMethod
|
Loading…
Reference in New Issue