tool
User-oriented tool library.
ProxyFilterProto
¶
Bases: Protocol
All proxy filter must implement like this.
Source code in src/fastapi_proxy_lib/core/_tool.py
__call__(url)
¶
Decide whether accept the proxy request by the given url.
Examples:
Refer to default_proxy_filter
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
URL
|
The target url of the client request to proxy. |
required |
Returns:
Name | Type | Description |
---|---|---|
None |
Union[None, str]
|
should accept the proxy request. |
str |
Union[None, str]
|
should rejetc the proxy request.
The |
Source code in src/fastapi_proxy_lib/core/_tool.py
default_proxy_filter(url)
¶
Filter by host.
If the host of url is ip address, which is not global ip address, then will reject it.
Warning
It will consumption time: 3.22~4.7 µs ± 42.6 ns.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
URL
|
The target url of the client request to proxy. |
required |
Returns:
Name | Type | Description |
---|---|---|
None |
Union[None, str]
|
should accept the proxy request. |
str |
Union[None, str]
|
should rejetc the proxy request.
The |