Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Token plugins provide a generic interface for transforming a token
into a
(host, port)
tuple.The plugin name is specified using the '--token-plugin' option,
and may either be the name of a class from
websockify.token_plugins
,or a fully qualified python path to the token plugin class (see below).
An optional plugin parameter can be specified using the '--token-source'
option (a value of
None
will be used if no '--token-source' option ispassed).
Token plugins should inherit from
websockify.token_plugins.BasePlugin
,and should implement the
lookup(token)
method. The value of the'--token-source' option is available as
self.source
.Several plugins are included by default. The
ReadOnlyTokenFile
and
TokenFile
plugins implement functionality from '--target-config'(with the former only reading the file(s) once, and the latter reading
them every time). The 'BaseTokenAPI' plugin fetches the value from
an API, returning the result of
process_result(response_object)
.By default,
process_result
simply returns the text of the response,but may be overriden. The
JSONTokenAPI
does just this, returningthe 'host' and 'port' values from the response JSON object.
The old '--target-config' option is now deprecated, and maps to the
TokenFile
plugin under the hood.Closes #157