Skip to content

Commit ebffd60

Browse files
committed
upd docs
1 parent 13e5221 commit ebffd60

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,6 @@ It is possible to filter (allow or deny) requests with simple `access` JS functi
321321
322322
`access` function must return boolean value, `true` allows request and `false` forbids it. Any exception will be reported to log and the corresponding request will be denied.
323323
324-
Also it is possible to use builtin `print` function to print arbitrary values into dumbproxy log for debugging purposes.
325-
326324
Example:
327325
328326
```js
@@ -360,8 +358,6 @@ dumbproxy can select upstream proxy dynamically invoking `getProxy` JS function
360358

361359
Note that this option can be repeated multiple times, same as `-proxy` option for chaining of proxies. These two options can be used together and order of chaining will be as they come in command line. For generalization purposes we can say that `-proxy` option is equivalent to `-js-proxy-router` option with script which returns just one static proxy.
362360

363-
`getProxy` scripts can read helper files using the built-in `readFile(path)` function that returns the file contents as a string.
364-
365361
`getProxy` function is invoked with the [same parameters](#access-filter-by-js-script) as the `access` function. But unlike `access` function it is expected to return proxy URL in string format *scheme://[user:password@]host:port* or empty string `""` if no additional upstream proxy needed (i.e. direct connection if there are no other proxy dialers defined in chain). See [supported upstream proxy schemes](#supported-upstream-proxy-schemes) for details.
366362

367363
Example:
@@ -382,6 +378,13 @@ function getProxy(req, dst, username) {
382378
>
383379
> This shouldn't be much of concern, though, if `getProxy` function doesn't use dst.resolvedHost and returns consistent values across invocations with the rest of inputs having same values.
384380
381+
### Scripting functions
382+
383+
Following builtin functions are addionally available within JS scripts:
384+
385+
* `print(val)` - print arbitrary values *val* into dumbproxy log for debugging purposes.
386+
* `readFile(path: string): string` - read file from *path* and return its content as a string.
387+
385388
## Supported upstream proxy schemes
386389

387390
Supported proxy schemes are:

0 commit comments

Comments
 (0)