added some API docs for the Socks5 routes
This commit is contained in:
parent
983a6e2cd7
commit
188869b83e
|
@ -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
|
11
README.md
11
README.md
|
@ -336,7 +336,8 @@ It has the following options:
|
||||||
secret A 128-bit or greater string to use for signing tokens (HMAC JWT)
|
secret A 128-bit or greater string to use for signing tokens (HMAC JWT)
|
||||||
ex: abc123
|
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
|
ex: api.tunnel.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -399,13 +400,7 @@ mdig _cloud._tcp.local
|
||||||
|
|
||||||
### api
|
### api
|
||||||
|
|
||||||
The API system is intended for use with Desktop and Mobile clients.
|
See [API.md](/API.md)
|
||||||
It must be accessed using one of the following domains as the Host header:
|
|
||||||
|
|
||||||
```
|
|
||||||
admin.invalid
|
|
||||||
localhost.admin.daplie.me
|
|
||||||
```
|
|
||||||
|
|
||||||
@tigerbot: How are the APIs used (in terms of URL, Method, Headers, etc)?
|
@tigerbot: How are the APIs used (in terms of URL, Method, Headers, etc)?
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ module.exports = function (myDeps, conf, overrideHttp) {
|
||||||
path.modules.forEach(mapMap);
|
path.modules.forEach(mapMap);
|
||||||
});
|
});
|
||||||
|
|
||||||
return app.use('/api/com.daplie.goldilocks/:name', function (req, res, next) {
|
function _goldApis(req, res, next) {
|
||||||
if (!goldilocksApis) {
|
if (!goldilocksApis) {
|
||||||
goldilocksApis = createGoldilocksApis();
|
goldilocksApis = createGoldilocksApis();
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,11 @@ module.exports = function (myDeps, conf, overrideHttp) {
|
||||||
} else {
|
} else {
|
||||||
next();
|
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) {
|
if (!req.headers.host) {
|
||||||
next(new Error('missing HTTP Host header'));
|
next(new Error('missing HTTP Host header'));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -446,8 +446,8 @@ module.exports.create = function (deps, conf, greenlockMiddleware) {
|
||||||
|
|
||||||
prom.then(function (handled) {
|
prom.then(function (handled) {
|
||||||
// XXX TODO SECURITY html escape
|
// XXX TODO SECURITY html escape
|
||||||
var host = (headers.host || '[no host header]').replace(/</, '<');
|
var host = (headers.host || '[no host header]').replace(/</, '<');
|
||||||
// TODO specify filepath of config file or database connection, etc
|
// 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.";
|
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) {
|
if (!handled) {
|
||||||
conn.end([
|
conn.end([
|
||||||
|
|
|
@ -274,7 +274,7 @@ module.exports.create = function (deps, config, netHandler) {
|
||||||
);
|
);
|
||||||
|
|
||||||
var wrapped;
|
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.
|
// opened, otherwise it might hang open when the decrypted side is destroyed.
|
||||||
// https://github.com/nodejs/node/issues/14605
|
// https://github.com/nodejs/node/issues/14605
|
||||||
function emitSock() {
|
function emitSock() {
|
||||||
|
|
Loading…
Reference in New Issue