Skip to content

feat: add --proxy and --source-addr to the client commands - #26

Merged
boeboe merged 3 commits into
mainfrom
feat/proxy-source-addr
Nov 9, 2026
Merged

boeboe merged 3 commits into
mainfrom
feat/proxy-source-addr

Conversation

@boeboe

@boeboe boeboe commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • --proxy socks5://host:port / socks5h:// (SUNSPECCTL_PROXY) and --source-addr <ip> (SUNSPECCTL_SOURCE_ADDR) on detect, models, read, read-model, read-point, poll* and capture, modelled on feat: --proxy and --source-addr on every connecting command; go-s7comm v0.15.0 s7commctl#23.
  • go-modbus v1.13.1 → v1.14.1; clientConfig sets modbus.Config.Dialer from the flags (dial.go). No other dial path exists: go-sunspec discovery runs on the Modbus client.
  • internal/netdial: SOCKS5 CONNECT client (RFC 1928, no auth, no new dependency) ported from s7commctl, with --source-addr binding TCP and UDP (udp, rtuoverudp). internal/socks5test: the scripted test proxy.
  • Transport rules: --proxy for tcp, tcp+tls, rtuovertcp, asciiovertcp; usage error (exit 2) with udp/rtuoverudp (no UDP ASSOCIATE). Either flag with rtu:///ascii://, or on serve, is a usage error (serve ignores the env vars). Invalid values are usage errors before anything is sent. A refusing proxy is exit 4, a silent one exit 5.
  • tcp+tls handshakes through the proxy, verified against the URL host.
  • Docs: README (global flags table + "Reaching the device" section, requirements), SECURITY.md (proxies), docs/exitcodes.md, RELEASE.md ## v0.7.0.

Tests

  • internal/netdial and internal/socks5test at 100 %.
  • dial_test.go: every client command through the proxy to a fake SunSpec device, socks5h name forwarding, tcp+tls through the proxy plus a URL host the certificate doesn't hold failing, refusing/silent proxy exit codes, --source-addr on TCP, UDP and RTU-over-UDP, env vars (flag beats env), every invalid value and transport mismatch as exit 2 on every client command with the proxy seeing nothing.
  • make check green (coverage 99.8 %), make e2e green.

🤖 Generated with Claude Code

boeboe and others added 3 commits November 9, 2026 23:37
Every command that connects to a device (detect, models, read*, poll*,
capture) takes --proxy socks5://host:port (or socks5h://) and
--source-addr <ip>, also as SUNSPECCTL_PROXY and SUNSPECCTL_SOURCE_ADDR.
They build go-modbus v1.14.1's Config.Dialer: a SOCKS5 CONNECT client
(RFC 1928, no authentication, ported from s7commctl) for the TCP
transports, and a bound local address for TCP and UDP. --proxy with
udp/rtuoverudp, either flag with rtu/ascii or on serve, and invalid
values are usage errors before anything is sent. tcp+tls verifies the
device certificate against the URL host through the proxy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@boeboe
boeboe merged commit aff97d2 into main Nov 9, 2026
23 checks passed
@boeboe
boeboe deleted the feat/proxy-source-addr branch November 9, 2026 22:48
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.

1 participant