Skip to main content

gera2ld.socks

PyPI

This is a SOCKS server and client package built with asyncio (requires Python 3.5+).

Installation

$ pip3 install gera2ld.socks

Usage

  • SOCKS server

    shell command:

    # Start a server
    $ python3 -m gera2ld.socks.server -b 127.0.0.1:1080
    

    or python script:

    from gera2ld.pyserve import run_forever
    from gera2ld.socks.server import Config, SOCKSServer
    
    config = Config('127.0.0.1:1080')
    run_forever(SOCKSServer(config).start_server())
    
  • SOCKS client

    import asyncio
    from gera2ld.socks.client import create_client
    
    client = create_client('socks5://127.0.0.1:1080')
    loop = asyncio.get_event_loop()
    loop.run_until_complete(client.handle_connect(('www.google.com', 80)))
    client.writer.write(b'...')
    print(loop.run_until_complete(client.reader.read()))
    
  • SOCKS handler for urllib

    from urllib import request
    from gera2ld.socks.client.handler import SOCKSProxyHandler
    
    handler = SOCKSProxyHandler('socks5://127.0.0.1:1080')
    
    opener = request.build_opener(handler)
    r = opener.open('https://www.example.com')
    print(r.read().decode())
    
  • SOCKS client for UDP

    import asyncio
    from gera2ld.socks.client import create_client
    
    async def main():
        client = create_client('socks5://127.0.0.1:1080')
        udp = await client.handle_udp()
        udp.write_data(b'\xc9\xa7\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x03www\x06google\x03com\x00\x00\xff\x00\x01', ('114.114.114.114', 53))
        print(await udp.results.get())
    
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())
    

Release files for gera2ld.socks 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gera2ld.socks 0.5.0
File Size Uploaded
gera2ld.socks-0.5.0.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gera2ld.socks 0.5.0
File Interpreter ABI Platform
gera2ld.socks-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 28.6 kB

Release files / gera2ld.socks-0.5.0.tar.gz

Download URL gera2ld.socks-0.5.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1bcc9bbc55f5eb03bba2c7bc66092e15b5970b8f490d49c1e648c3cf4b6746dd
BLAKE2b-256 checksum
How to use checksums
9bb21f513b1106195ed988653010145a6b94e73e48e9000e19a1c6a85ea3dff6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.9.6 Darwin/20.5.0

Release files / gera2ld.socks-0.5.0-py3-none-any.whl

Download URL gera2ld.socks-0.5.0-py3-none-any.whl
Size 17.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0362211167592d1bb55a2478ee8f2177ea5d47f4e9e01dec562632150cf5f03e
BLAKE2b-256 checksum
How to use checksums
f927438809cb2b6681cacf98512081e691eb20fe99b3500ce4cee0e1b3ad08bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.9.6 Darwin/20.5.0

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page