proxy.plugin.shortlink module#
proxy.py#
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging.
- copyright
2013-present by Abhinav Singh and contributors.
- license
BSD, see LICENSE for more details.
- class proxy.plugin.shortlink.ShortLinkPlugin(uid: str, flags: argparse.Namespace, client: proxy.http.connection.HttpClientConnection, event_queue: proxy.core.event.queue.EventQueue, upstream_conn_pool: Optional[UpstreamConnectionPool] = None)[source]#
Bases:
proxy.http.proxy.plugin.HttpProxyBasePlugin
Add support for short links in your favorite browsers / applications.
Enable ShortLinkPlugin and speed up your daily browsing experience.
Example:: *
f/
forfacebook.com
*g/
forgoogle.com` * ``t/
fortwitter.com
*y/
foryoutube.com
*proxy/
forpy
internal web servers. Customize map below for your taste and need.Paths are also preserved. E.g.
t/imoracle
will resolve to http://twitter.com/imoracle.- SHORT_LINKS = {b'a': b'amazon.com', b'f': b'facebook.com', b'g': b'google.com', b'i': b'instagram.com', b'l': b'linkedin.com', b'proxy': b'localhost:8899', b't': b'twitter.com', b'w': b'web.whatsapp.com', b'y': b'youtube.com'}#
- _abc_impl = <_abc._abc_data object>#
- before_upstream_connection(request: proxy.http.parser.parser.HttpParser) Optional[proxy.http.parser.parser.HttpParser] [source]#
Handler called just before Proxy upstream connection is established.
Return optionally modified request object. If None is returned, upstream connection won’t be established.
Raise HttpRequestRejected or HttpProtocolException directly to drop the connection.
- handle_client_request(request: proxy.http.parser.parser.HttpParser) Optional[proxy.http.parser.parser.HttpParser] [source]#
Handler called before dispatching client request to upstream.
Note: For pipelined (keep-alive) connections, this handler can be called multiple times, for each request sent to upstream.
Note: If TLS interception is enabled, this handler can be called multiple times if client exchanges multiple requests over same SSL session.
Return optionally modified request object to dispatch to upstream. Return None to drop the request data, e.g. in case a response has already been queued. Raise HttpRequestRejected or HttpProtocolException directly to tear down the connection with client.