Skip to main content

freebind-py

Use the IPv6 addresses in a prefix routed to your Linux machine, without assigning every address to a network interface. freebind-py brings the idea of the original Freebind by blechschmidt to Python sockets, Requests, aiohttp, HTTPX, and curl_cffi. Credit for the original tool and its IPv6 source-rotation approach belongs to that project.

Why Freebind?

An IPv6 allocation gives one host many possible source addresses. Freebind lets each new socket bind to a randomly selected address in that allocation. This can bypass IPv6 rate limits keyed only by source address (/128). If a service limits whole /64 prefixes, rotating addresses inside one /64 will not help; a routed /48, for example, lets you select addresses across many /64s. This is one machine using many IPs, not one fixed IP changing prefixes. Account-based limits and limits covering your whole allocation still apply.

The core uses Python's standard library and supports IPv4 as well as IPv6, TCP and UDP. HTTP integrations are optional. Socket operations require Linux; Python 3.11–3.14 is covered by CI. Async support uses asyncio.

Install

Requires Python 3.11 or newer. Socket operations require Linux.

Install the core or the integration you need from PyPI:

python -m pip install freebind-py
python -m pip install 'freebind-py[requests]'
python -m pip install 'freebind-py[aiohttp]'
python -m pip install 'freebind-py[httpx]'
python -m pip install 'freebind-py[curl-cffi]'
python -m pip install 'freebind-py[all]'

The distribution is named freebind-py; import it as freebind.

Quick start

Use a source address your network routes to this machine. This example uses loopback so it can run locally without configuring nonlocal routes:

import socket
from freebind import Source, new_socket

with new_socket(Source("::1"), type=socket.SOCK_DGRAM) as sock:
    print(sock.getsockname())

For source rotation, use an IPv6 prefix routed to your machine and a destination with an IPv6 address. Replace 2001:db8:100::/48 (a documentation-only prefix) and the URL below with your own. On Linux, configure the local AnyIP route for your actual allocation first:

sudo ip -6 route add local 2001:db8:100::/48 dev lo

This route does not obtain an allocation or configure your upstream router. Your provider must route the prefix back to this machine; on-link allocations also need working Neighbor Discovery. Then select a new source per connection:

import requests
from freebind import Source
from freebind.requests import FreebindAdapter

source = Source("2001:db8:100::/48")
with requests.Session() as client:
    client.trust_env = False
    client.mount("https://", FreebindAdapter(source, fresh=True))
    for _ in range(3):
        response = client.get("https://service.example/", timeout=5)
        response.raise_for_status()
        print(response.text)

Install the requests extra to use this example. aiohttp and HTTPX integrations also support asyncio; HTTPX provides both sync and async transports.

For curl_cffi browser impersonation, use its Freebind session:

from freebind import Source
from freebind.curl_cffi import FreebindSession

with FreebindSession(Source("2001:db8:100::/48"), impersonate="chrome") as client:
    for _ in range(3):
        response = client.get("https://service.example/", timeout=5)
        response.raise_for_status()
        print(response.text)

Install the curl-cffi extra. AsyncFreebindSession provides the asyncio API. These sessions disable environment proxies by default.

Source policies and connections

  • An IP selects a fixed source address.
  • A CIDR selects a random address for each new socket.
  • Source(prefix, mode="sticky") selects one address per configured family and reuses it for that policy.
  • bits= controls how many leading host bits are randomized. For a /48, bits=16 varies the next 16 bits, selecting among its /64 prefixes.
  • HTTP clients pool connections by default. Pass fresh=True to an adapter, connector, transport, or curl_cffi session to create a new connection per request.

Freebind allows binding nonlocal addresses; it does not configure routing. The machine needs a local route for the source prefix, the peer needs a return route, and the upstream network must carry the traffic. A successful bind alone does not establish reachability. Explicit HTTP proxies are unsupported; disable environment proxies with trust_env=False.

Documentation

The user guide covers IPv4/IPv6 source selection, TCP/UDP sockets, asyncio, Requests, aiohttp, HTTPX, curl_cffi browser impersonation, TLS, pooling, process-wide patching, and troubleshooting. Documentation and runnable examples are also included in the source distribution under docs/ and examples/.

See contributing and releases for local setup, linting, tests, and publishing.

See the changelog for release notes.

License

GPL-3.0-only. The original C Freebind project is also GPL-3.0. The AGPL-3.0 freebind.js project informed behavior only; no JavaScript implementation code was copied into this package.

Metadata

Release files for freebind-py 0.2.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 freebind-py 0.2.0
File Size Uploaded
freebind_py-0.2.0.tar.gz 76.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for freebind-py 0.2.0
File Interpreter ABI Platform
freebind_py-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 106.4 kB

Release files / freebind_py-0.2.0.tar.gz

Download URL freebind_py-0.2.0.tar.gz
Size 76.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7fd3f46d6916c11c710d0914fa5a22db77cfbbcbb84e5b4ca02ffbe8dec3a28b
BLAKE2b-256 checksum
How to use checksums
8e9741b5c036a26184d8c2f3ed216cde5ef56618a0ce8276c332ed7be670fc27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / freebind_py-0.2.0-py3-none-any.whl

Download URL freebind_py-0.2.0-py3-none-any.whl
Size 30.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d28f285532aead4c812eedd3bee3d9f1ae56002e140bf682a533f711ab3422ab
BLAKE2b-256 checksum
How to use checksums
c36d886546559a517bf556c4e46f93a72cba6f7f71c5628ede89d431a9a0863a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

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