107 Commits

Author SHA1 Message Date
zarazaex69
98c6dec4a0 docs: normalize em dash to hyphen in Russian documentation and code comments 2026-05-24 05:31:55 +03:00
zarazaex69
5839b05763 fix: cancel go t -> startControlLoop 2026-05-21 14:17:39 +03:00
zarazaex69
4b7185f411 fix(client): survive liveness loss without killing SOCKS listener 2026-05-21 13:42:22 +03:00
zarazaex69
74bb402289 fix(runtime): account for smux frame overhead in wire payload cap 2026-05-19 23:34:37 +03:00
zarazaex69
c6c301c058 fix: handle graceful control shutdown and reconnects 2026-05-17 18:35:05 +03:00
zarazaex69
80cc3bafe4 chore(lint): satisfy golangci-lint after big refactor
Address 25 issues reported by golangci-lint following the structural
refactor:

- cyclop: split common.Reassembler.Push into upsert/storeChunk/deliver
  helpers (12→5). Move seichannel option-default fill into Options.
  withDefaults so New stays under the limit.
- exhaustive: enumerate ResultPartial / ResultIgnore explicitly in
  seichannel and videochannel switches over common.Result.
- gosec G115: annotate the test-fixture int→uint16/uint32 conversions
  in common_test.go with //nolint:gosec.
- lll: break up the 130+ character one-liners in transport
  unit/integration tests and the videochannel track-ID construction.
- nolintlint: drop the stale //nolint:cyclop in mobile_test.go where
  the underlying complexity already cleared the limit.
- wrapcheck: wrap errors returned from internal/framing and
  internal/runtime in their public callers (handshake, control,
  server.setupCipher, client.setupCipher) so they carry the layer name.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:38:03 +03:00
zarazaex69
f469bd72af refactor: extract shared session runtime into internal/runtime
server.go and client.go each carried byte-identical copies of
smuxConfig (~20 lines), setupCipher (~18 lines), and the health
bookkeeping pair recordSession/Pong/Missed/Unhealthy/Reconnect plus a
private healthMu+status+notifyHealth scaffold. Same code, twice.

Add internal/runtime exposing:
- SetupCipher, SmuxConfig, MaxPayload — common construction helpers,
  ErrKeyRequired/ErrKeySize re-exported from runtime so existing
  errors.Is checks on server.ErrKeyRequired etc. keep working.
- HealthTracker — nil-safe wrapper around control.Status with
  RecordSession/Pong/Missed/Unhealthy/Reconnect that publishes through an
  OnHealth callback supplied at construction.

server and client now hold a *runtime.HealthTracker instead of their own
mu+status+notify scaffolds. recordX methods on Server/Client are now
one-liners that forward to the tracker. smuxConfig(0) replaces the prior
variadic smuxConfig() in test call sites; nil-safe Status()/update() on
HealthTracker means tests that build raw &Server{}/&Client{} no longer
need to wire up a tracker for the records to be no-ops.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:24:46 +03:00
zarazaex69
e7657b2619 refactor: remove link layer
internal/link and internal/link/direct were a single-implementation
abstraction layer where directLink mechanically proxied every method to
transport.Transport — only Features() lived above transport.Transport,
and even that was a Features() alias. Six layers of plumbing for zero
behavioural value.

Drop the layer entirely:
- muxconn.Conn now takes a transport.Transport directly.
- server.Server and client.Client store transport.Transport, call
  transport.New, and expose Features() through transport.Transport's
  built-in method.
- server.Config and client.Config lose their Link string field.
- session.Config loses Link + validateLink + ErrLinkRequired/ErrUnsupportedLink.
- config.File and config.Profile lose the link YAML key.
- pkg/olcrtc/tunnel.Config loses Link.
- mobile drops defaultLink, SetLink, and mobileConfig.link.

Two e2e tests that exercised link.New directly are renamed to call
transport.New (TestTransportCreatesAllProviderTransportCombinations and
TestTransportConnectsFastProviderTransportMatrix); behaviour is unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 13:51:02 +03:00
zarazaex69
74fb1d81b7 refactor: introduce typed per-transport options
transport.Config used to carry a flat union of video+vp8+sei tuning fields
that every transport ignored except its own. Replace with an opaque
transport.Options marker interface and per-transport Options structs
(videochannel.Options, vp8channel.Options, seichannel.Options). Datachannel
keeps an unset Options.

link.Config gains TransportOptions and drops the 16 transport-specific
fields. server.Config and client.Config follow suit. session.Config is
left untouched in this commit — buildTransportOptions packs its existing
flat fields into the typed Options bundle before calling server/client
(session.Config is rebuilt in a later commit when YAML config moves to
typed sections).

Tests that synthesized link/server/client/transport configs are updated
to pass typed Options bundles. The shared e2eTransportOptions helper
replaces three copies of the flat field bundle in e2e/tunnel_test.go.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 07:01:07 +03:00
zarazaex69
6633c1ef8a fix: isolate videochannel peers in shared rooms 2026-05-16 04:55:25 +03:00
zarazaex69
ff90942214 fix: close sessions before connections on shutdown 2026-05-16 04:13:07 +03:00
zarazaex69
6222896921 refactor: improve error context and test clarity 2026-05-16 04:06:55 +03:00
cyber-debug
b7a7e40899 feat: add safe traffic shaping and TLS hardening 2026-05-16 02:10:34 +03:00
cyber-debug
4c6bd2b838 feat: expose control health status 2026-05-16 02:10:33 +03:00
cyber-debug
b0fc3bd0f1 feat: add control stream liveness 2026-05-16 02:10:33 +03:00
zarazaex69
82e8067384 fix(client,server): defer shutdown BEFORE bringUpLink to close MUC on early failures
When bringUpLink errored — a handshake timeout against a wedged transport,
for instance — Run/RunWithReady returned straight to the caller without
calling shutdown, so the carrier link that had already joined the MUC
was never closed. The result was a ghost participant lingering on
Jicofo/JVB until idle timeout, which the next test in the same room
inherited as stale endpoints in 'bridge open'.

The clue from logs was that failing seichannel runs produced one
'leave-muc handshake ok' instead of two: the server's normal
ctx-cancel path got there cleanly, but the client's bringUpLink
returned early and skipped its defer.

Both paths now register shutdown before the bringUpLink call. shutdown
is nil-safe and idempotent so it works whether or not bringUpLink
actually populated link/session fields. server's wg.Wait moves into
the same defer so wg goroutines spawned by partial setup also drain
before Run returns.
2026-05-16 01:38:52 +03:00
zarazaex69
76c709f9a5 fix: golangci lint fix 2026-05-14 04:21:11 +03:00
zarazaex69
b36bee3f0e fix: harden reconnect shutdown and vp8 startup 2026-05-14 02:45:11 +03:00
zarazaex69
20f2c1397c feat: add timeout to openControlStream function 2026-05-13 22:07:34 +03:00
zarazaex69
bcc6b2ee5c feat: remove unused client ID from config 2026-05-13 20:03:58 +03:00
zarazaex69
51e6e8a39c refactor: configuration structures instead of 27 arguments 2026-05-13 16:16:56 +03:00
zarazaex69
dc1fe0f19c refactor: replace -carrier with -auth/-engine/-url/-token (stage E)
Break CLI backwards compatibility as planned for refactor/universal-carrier:

- Drop -carrier flag; add -auth (auth provider name), -engine (engine
  name for -auth none), -url and -token (SFU endpoint + access token for
  direct/none auth mode).
- session.Config.Carrier → Auth + Engine + URL + Token.
- session.Gen() is now generic: auth.Get(cfg.Auth).(auth.RoomCreator)
  replaces the hard-coded switch on carrier names.
- Register a "none" carrier in builtin (registerDirect) that bypasses
  auth and connects directly to any engine with caller-supplied URL+Token.
- auth/telemost.Provider.Issue now accepts a raw room-ID hash in addition
  to a full https://telemost.yandex.ru/j/<id> URL.
- Plumb Engine/URL/Token from session.Config through server.Run,
  client.Run/RunWithReady, bringUpLink, link.Config, transport.Config, and
  carrier.Config so the "none" carrier has access to them end-to-end.
- Update all tests and mobile.go call sites.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 13:31:07 +03:00
zarazaex69
0723ddf2f5 fix: golangci errors 2026-05-11 02:21:41 +03:00
zarazaex69
1070c34f3a Merge remote-tracking branch 'origin/master' into refactor/weekrefactor 2026-05-10 23:06:36 +03:00
zarazaex69
f6b82da099 feat: remove nolint 2026-05-10 23:02:00 +03:00
zarazaex69
efd1d5ff16 fix: test dont work 2026-05-10 22:51:51 +03:00
Alexander Anisimov
c4b67e704b fix lint 2026-05-10 18:27:00 +03:00
Alexander Anisimov
8348c3d026 fix socks5 2026-05-10 18:20:10 +03:00
zarazaex69
7aec207603 fix: integer overflow conversion in client 2026-05-10 14:11:58 +03:00
zarazaex69
7128dafda2 feat(socks, test): add test for socks5 user and password 2026-05-10 13:56:20 +03:00
zarazaex69
af49d17e8e feat(socks): add socks5 user and password 2026-05-10 13:56:03 +03:00
zarazaex69
87a546605c fix: golangci 2026-05-07 16:36:30 +03:00
zarazaex69
e4212b346b feat(sei): add sei config 2026-05-07 01:08:35 +03:00
zarazaex69
63dd61c61d fix(test): fix all test bugs 2026-05-07 00:38:52 +03:00
zarazaex69
aa49808e68 feat(test): init base test 2026-05-06 22:33:29 +03:00
zarazaex69
0cae2d0b8f fix: golangci errors 2026-05-06 19:55:09 +03:00
zarazaex69
1965cff5cf fix: -client-id bug 2026-05-06 19:23:16 +03:00
zarazaex69
8be56493f0 feat: add clientid key 2026-05-06 19:23:16 +03:00
zarazaex69
3c816a38e8 fix: state 2026-05-03 11:54:13 +03:00
zarazaex69
dd606ddfb2 fix: fix all golangci errors 2026-05-03 06:10:48 +03:00
zarazaex69
5bb8178e50 feat(smux): replace internal/mux with smux over KCP
Replace the hand-rolled multiplexer (internal/mux) with xtaci/smux v2
running on top of the existing KCP-reliable vp8channel transport.

- Add internal/muxconn: io.ReadWriteCloser adapter bridging link.Link
  (message-oriented) into the byte-stream smux expects; applies AEAD
  on every write and inverts it on every received message
- Rewrite client: smux.Client session over muxconn; OpenStream per
  SOCKS5 connection; reconnect handler tears down and rebuilds session
- Rewrite server: smux.Server session; AcceptStream loop dispatches
  each stream to a proxy handler; tolerates session bounces on reconnect
- Delete internal/mux: all sequence/reorder/buffer logic is now
  handled by smux + KCP
2026-05-03 00:45:58 +03:00
zarazaex69
ad7c9a5c3e feat: add tile as videochannel visual codec via -video-codec tile 2026-04-30 06:55:34 +03:00
zarazaex69
689441a7f4 Add configurable QR error correction level for video transpor 2026-04-27 18:53:39 +03:00
zarazaex69
a2d1b95ffa feat: add support for 'b' visual codec in videochannel 2026-04-22 21:26:50 +03:00
zarazaex69
6379fa527e feat: add vp8-fps and vp8-batch settings for vp8channel throughput tuning 2026-04-22 17:17:08 +03:00
zarazaex69
af34cdbd8e feat: add video-qr-size configuration for videochannel transport 2026-04-21 22:32:01 +03:00
zarazaex69
f6cfaf8081 refactor: implement explicit shutdown logic for client connections and server stream pumps 2026-04-21 02:30:18 +03:00
zarazaex69
513e2bdd9d feat: refactor client connection handling and error management 2026-04-21 01:51:48 +03:00
zarazaex69
9e09975165 feat: implement video channel transport 2026-04-21 01:32:17 +03:00
zarazaex69
2cad1b0e87 refactor: align tunnel runtime terminology 2026-04-20 20:20:02 +03:00