Skip to content

[Tunnel] Add octobot_tunnel package (as Piko client)#3437

Draft
Herklos wants to merge 1 commit intodevfrom
claude/python-piko-client-ncoon
Draft

[Tunnel] Add octobot_tunnel package (as Piko client)#3437
Herklos wants to merge 1 commit intodevfrom
claude/python-piko-client-ncoon

Conversation

@Herklos
Copy link
Copy Markdown
Contributor

@Herklos Herklos commented May 3, 2026

Implements a full Python equivalent of the Go github.com/andydunstall/piko/client SDK:

  • yamux/: Pure-Python yamux multiplexer protocol (frame encode/decode, session,
    stream with flow-control window management)
  • client/: Upstream (listen on endpoint), Listener (accept multiplexed streams,
    auto-reconnect with exponential backoff), Dialer (outbound TCP connections),
    Forwarder (bidirectional bridge to local address), WebSocket transport wrapper
    (aiohttp), Logger protocol, Backoff, typed exceptions

@Herklos Herklos requested a review from GuillaumeDSM as a code owner May 3, 2026 08:37
@Herklos Herklos marked this pull request as draft May 3, 2026 08:38
@Herklos Herklos changed the title [Tunnel] Add octobot_tunnel package — Python Piko client (TDD) [Tunnel] Add octobot_tunnel package (as Piko client) May 3, 2026
@Herklos Herklos changed the base branch from master to dev May 3, 2026 08:39
@Herklos Herklos force-pushed the claude/python-piko-client-ncoon branch 2 times, most recently from 7c51c77 to 610f11d Compare May 3, 2026 08:43
Full Python reimplementation of the Go piko/client SDK using asyncio
and aiohttp, with yamux multiplexing over WebSocket.

- yamux: frame encode/decode, client-side session (accept queue, flow
  control, ping/pong, GoAway), per-stream send window and EOF/RST
- client: Upstream (listen, listen_and_forward, exponential-backoff
  reconnect), Listener (accept_with_context, auto-reconnect on session
  drop), Dialer, Forwarder (bidirectional copy with TCP half-close),
  Stream, Backoff, WebSocketTransport
- Session disconnect now unblocks pending accept() callers via sentinel
- Stream.read(n) returns any available bytes (matches net.Conn.Read),
  not exactly n bytes; WebSocketTransport gains a matching read() method
- Cancelled tasks in accept_with_context are properly awaited
- Listener.close() uses session.send_go_away() public API
- 140 tests covering all components (TDD)

https://claude.ai/code/session_01QjvZSQCamcHU9NR5MxMzN1
@Herklos Herklos force-pushed the claude/python-piko-client-ncoon branch from 610f11d to af22012 Compare May 3, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants