added some API docs for the Socks5 routes

Este commit está contenido en:
tigerbot 2017-08-04 14:38:22 -06:00
padre 983a6e2cd7
commit 188869b83e
Se han modificado 5 ficheros con 39 adiciones y 13 borrados

27
API.md Archivo normal
Ver fichero

@ -0,0 +1,27 @@
# API
The API system is intended for use with Desktop and Mobile clients.
It must be accessed using one of the following domains as the Host header:
```
admin.invalid
localhost.admin.daplie.me
```
## Socks5 Proxy
### Check Status
* **URL** `/api/goldillocks@daplie.com/socks5`
* **Method** `GET`
* **Response**: The returned object will have up to two values inside
* `running`: boolean value to indicate if the proxy is currently active
* `port`: if the proxy is running this is the port it's running on
### Start Proxy
* **URL** `/api/goldillocks@daplie.com/socks5`
* **Method** `POST`
* **Response**: Same response as for the `GET` resquest
### Stop Proxy
* **URL** `/api/goldillocks@daplie.com/socks5`
* **Method** `DELETE`
* **Response**: Same response as for the `GET` resquest

Ver fichero

@ -336,7 +336,8 @@ It has the following options:
secret A 128-bit or greater string to use for signing tokens (HMAC JWT)
ex: abc123
servernames An array of string servernames that should be captured as the tunnel server, ignoring the TLS forward module
servernames An array of string servernames that should be captured as the
tunnel server, ignoring the TLS forward module
ex: api.tunnel.example.com
```
@ -399,13 +400,7 @@ mdig _cloud._tcp.local
### api
The API system is intended for use with Desktop and Mobile clients.
It must be accessed using one of the following domains as the Host header:
```
admin.invalid
localhost.admin.daplie.me
```
See [API.md](/API.md)
@tigerbot: How are the APIs used (in terms of URL, Method, Headers, etc)?

Ver fichero

@ -114,7 +114,7 @@ module.exports = function (myDeps, conf, overrideHttp) {
path.modules.forEach(mapMap);
});
return app.use('/api/com.daplie.goldilocks/:name', function (req, res, next) {
function _goldApis(req, res, next) {
if (!goldilocksApis) {
goldilocksApis = createGoldilocksApis();
}
@ -124,7 +124,11 @@ module.exports = function (myDeps, conf, overrideHttp) {
} else {
next();
}
}).use('/', function (req, res, next) {
}
return app
.use('/api/com.daplie.goldilocks/:name', _goldApis)
.use('/api/goldilocks@daplie.com/:name', _goldApis)
.use('/', function (req, res, next) {
if (!req.headers.host) {
next(new Error('missing HTTP Host header'));
return;

Ver fichero

@ -446,8 +446,8 @@ module.exports.create = function (deps, conf, greenlockMiddleware) {
prom.then(function (handled) {
// XXX TODO SECURITY html escape
var host = (headers.host || '[no host header]').replace(/</, '&lt;');
// TODO specify filepath of config file or database connection, etc
var host = (headers.host || '[no host header]').replace(/</, '&lt;');
// TODO specify filepath of config file or database connection, etc
var msg = "Bad Gateway: Goldilocks accepted '" + host + "' but no module (neither static nor proxy) was designated to handle it. Check your config file.";
if (!handled) {
conn.end([

Ver fichero

@ -274,7 +274,7 @@ module.exports.create = function (deps, config, netHandler) {
);
var wrapped;
// We can't emit the connection to the TLS server until we don't the connection is fully
// We can't emit the connection to the TLS server until we know the connection is fully
// opened, otherwise it might hang open when the decrypted side is destroyed.
// https://github.com/nodejs/node/issues/14605
function emitSock() {