127 Commits

Author SHA1 Message Date
zarazaex69 da3bf43721 style: normalize dash usage in comments and logs 2026-05-29 22:08:36 +03:00
zarazaex69 52aea2d79d fix(vp8channel): add byte-rate pacer to prevent policer collapse 2026-05-29 19:16:59 +03:00
zarazaex69 33f46460dc test(e2e): tune videochannel params and reduce chunk timeout 2026-05-28 13:19:14 +03:00
zarazaex69 1427c0d3c7 fix(videochannel): increase timeouts to handle SFU renegotiation delays 2026-05-28 05:54:18 +03:00
zarazaex69 9f25ac59fc perf(videochannel): reduce ack timeout and multiplier 2026-05-28 02:42:50 +03:00
zarazaex69 57db32f70c chore: remove gr git submodule 2026-05-27 11:31:19 +03:00
zarazaex69 4ab4413f50 refactor(videochannel): remove ffmpeg support and fix lint 2026-05-27 11:08:49 +03:00
zarazaex69 552151fece fix(videochannel): force VP8 keyframes and drop bad frames 2026-05-27 10:55:37 +03:00
zarazaex69 0a5d3fb922 fix(videochannel): ignore vp8 missing reference errors 2026-05-27 07:54:33 +03:00
zarazaex69 65dbb93221 refactor(videochannel): replace ffmpeg with Go VP8 codec
- thnks rape4me/kc for vp8 enc/dec
2026-05-26 19:11:11 +03:00
zarazaex69 d7c813265b fix(vp8channel): rotate epoch header on KCP reset 2026-05-26 12:42:41 +03:00
zarazaex69 b8933e10b5 docs: replace em dashes with hyphens in docs and comments 2026-05-26 10:27:04 +03:00
zarazaex69 10c7c655b6 fix(vp8channel): reset peer state on KCP restart 2026-05-26 02:50:29 +03:00
zarazaex69 b797858857 perf(seichannel): increase frame rate and batch size defaults 2026-05-25 22:39:41 +03:00
zarazaex69 09f591a26b fix(seichannel): scale ack timeout with fragment count and skip
re-enqueue on retry
2026-05-25 22:21:42 +03:00
zarazaex69 e677261fd5 refactor: improve error wrapping and extract constructor helper 2026-05-25 04:06:26 +03:00
zarazaex69 83a94948ae fix(vp8channel): latch peer epoch on first frame received 2026-05-24 18:05:43 +03:00
zarazaex69 6d529c16a8 fix(vp8channel): latch peer only after handshake confirms it
Previously the client latched on the first epoch it saw, which could
be another client in the room. Now it accepts frames from all epochs
until onData delivers the first KCP message (handshake welcome),
then locks to that epoch and ignores others.

Fixes #67
2026-05-24 17:49:02 +03:00
zarazaex69 11dfdcb512 fix(vp8channel): demote noisy 'ignoring frame' log to trace 2026-05-24 17:36:19 +03:00
zarazaex69 d0b0b8e9db fix(vp8channel): client ignores frames from other participants
In single-peer mode (client), frames from unknown epochs are now
silently dropped instead of triggering a reconnect loop. This
prevents the client from mistaking another client's VP8 track
for a server restart.

Part of #67
2026-05-24 17:33:51 +03:00
zarazaex69 cefd260e5d fix(vp8channel): support multiple simultaneous clients in same room
Implement PeerTransport interface (SendTo/SupportsPeerRouting) so the
server can route KCP traffic to individual peers by their epoch.

When OnPeerData is set (server mode), each remote epoch gets its own
KCP runtime instead of triggering a reconnect loop.

Also add DNS retry in protect.NewHTTPClient to handle transient
resolver failures.

Fixes #67
2026-05-24 17:27:02 +03:00
zarazaex69 98c6dec4a0 docs: normalize em dash to hyphen in Russian documentation and code comments 2026-05-24 05:31:55 +03:00
zarazaex69 618b210926 fix: golangci 2026-05-21 14:30:18 +03:00
zarazaex69 4b7185f411 fix(client): survive liveness loss without killing SOCKS listener 2026-05-21 13:42:22 +03:00
zarazaex69 bfa6d73ad1 feat(vp8channel): batch multiple KCP packets per RTP sample 2026-05-20 00:12:01 +03:00
zarazaex69 2b6f77f0f6 refactor(vp8channel): add ResetPeer with epoch rotation and mutex #60 2026-05-19 21:58:12 +03:00
zarazaex69 3bee3ddbe6 chore(vp8channel): update default fps to 60 and batch size to 64 2026-05-19 09:08:01 +03:00
zarazaex69 143f6dd8a6 feat: add peer-addressed routing across transport and engine layers 2026-05-18 02:38:45 +03:00
zarazaex69 9a2bbfd44e feat(videochannel): add per-fragment ack tracking 2026-05-17 05:45:43 +03:00
zarazaex69 b4dc6d2531 test: add nightly stress and churn coverage 2026-05-16 23:49:22 +03:00
zarazaex69 032151be98 fix(server): reset peer binding on handshake failure 2026-05-16 18:57:04 +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 190c2b5f84 chore(vp8channel): replace abusive header comment with package doc
internal/transport/vp8channel/transport.go opened with a 24-line block
of Russian profanity addressed at Yandex SFU engineers (the engine
vp8channel targets to evade). It served no engineering purpose and is
not suitable for an open-source codebase.

Replace with a one-paragraph package doc summarising what the package
actually does (KCP-over-VP8-keyframes byte transport for SFUs that
validate VP8 conformance).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:30:16 +03:00
zarazaex69 4639e0b3b7 refactor: extract shared transport framing helpers into internal/transport/common
videochannel, seichannel and vp8channel each carried independent copies of
randomID(), fragmentPayload(), inboundMessage + upsertInbound +
assembleMessage + ackWaiters/ackMu. The reassembly logic was almost
byte-identical across videochannel and seichannel; vp8channel only needed
randomID. Three copies of the same idea.

Add internal/transport/common with:
- RandomID(): 8-char hex per-peer ID (Jitsi msid uniqueness requirement).
- FragmentPayload(): split bytes into max-size chunks.
- Reassembler: stores in-flight messages keyed by Seq, validates CRC, and
  reports Partial / Delivered / Duplicate / Ignore via a Result enum.
- AckRegistry: Register/Unregister/Resolve for ack waiters.

videochannel and seichannel now hold *common.AckRegistry and
*common.Reassembler instead of raw maps + mutexes. Their Send paths route
through acks.Register/Unregister; their handleInboundFrame is a 20-line
switch over reassembler.Push. vp8channel keeps its KCP framing but reuses
common.RandomID.

Tests that constructed raw streamTransport with inbound/delivered/ackWaiters
maps are updated to instantiate the new common types instead. Two now-
redundant low-level tests (upsertInbound out-of-range, assembleMessage)
collapse into the new TestInboundRejectsBadCRC.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:16:43 +03:00
zarazaex69 a083dfc5f3 refactor: collapse carrier layer into engine
internal/carrier and internal/carrier/builtin sat between transports and
engines, wrapping every engine.Session in carrier.Session +
engineByteStream/engineVideoTrack adapters that mechanically proxied every
method. That layer existed solely to translate Capabilities/AddTrack names;
no behaviour lived above engine.

Replace with internal/engine/builtin: a name-keyed registry that calls
auth.Issue and engine.New directly. Transports look up engine.Session via
enginebuiltin.Open, then type-assert engine.VideoTrackCapable for video
transports. A small per-transport engineVideoSession adapter unifies the
reconnect callback signature (engine uses func(*webrtc.DataChannel); the
transports want func()).

Updates:
- internal/engine/builtin/builtin.go: new Register/Open registry + auth
  pass-through ("none") + auth-driven factories for jazz/telemost/wbstream/jitsi.
- internal/transport/datachannel/transport.go: uses engine.Session directly
  via Capabilities().ByteStream check.
- internal/transport/{seichannel,videochannel,vp8channel}: each gains an
  engineVideoSession adapter and routes Connect/Send/Close/AddTrack through
  the engine session.
- internal/app/session: imports enginebuiltin; carrier.Available() →
  enginebuiltin.Available().
- pkg/olcrtc/olcrtc.go: switches to enginebuiltin.RegisterDefaults.
- internal/carrier and internal/carrier/builtin: deleted.
- Tests rewritten to register a fakeEngineSession (implements engine.Session
  + engine.VideoTrackCapable) through enginebuiltin.Register. The e2e
  memoryStream gains the same dual interface so memorySession is gone.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 14:07:44 +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 a636236523 refactor(videochannel): simplify frame decoding logic 2026-05-16 05:01:41 +03:00
zarazaex69 6633c1ef8a fix: isolate videochannel peers in shared rooms 2026-05-16 04:55:25 +03:00
zarazaex69 6222896921 refactor: improve error context and test clarity 2026-05-16 04:06:55 +03:00
cyber-debug 79c1511268 Fix seichannel readiness before sending 2026-05-16 02:44:18 +03:00
cyber-debug b7a7e40899 feat: add safe traffic shaping and TLS hardening 2026-05-16 02:10:34 +03:00
zarazaex69 5e0a89a78d Revert "fix(transport): isolate peer frames by channel id"
This reverts commit 75e2674f48.
2026-05-15 23:09:24 +03:00
zarazaex69 a9512d2488 Revert "fix(transport): pin peer channel after validation"
This reverts commit 7f9351dad6.
2026-05-15 23:09:24 +03:00
zarazaex69 7f9351dad6 fix(transport): pin peer channel after validation 2026-05-15 22:53:58 +03:00
zarazaex69 75e2674f48 fix(transport): isolate peer frames by channel id 2026-05-15 22:47:32 +03:00
zarazaex69 6536249f72 feat: add randomID function to generate unique track and stream IDs 2026-05-15 22:00:45 +03:00
zarazaex69 b36bee3f0e fix: harden reconnect shutdown and vp8 startup 2026-05-14 02:45:11 +03:00
zarazaex69 bcc6b2ee5c feat: remove unused client ID from config 2026-05-13 20:03:58 +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 e25eed39a9 Merge remote-tracking branch 'origin/master' into pr-47-merge
# Conflicts:
#	cmd/olcrtc/main.go
#	internal/transport/videochannel/ffmpeg.go
2026-05-11 02:30:16 +03:00