Commit Graph

11 Commits

Author SHA1 Message Date
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
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
9cfb4fd9c3 docs: make jitsi the default recommended provider 2026-05-15 16:15:55 +03:00
zarazaex69
76c709f9a5 fix: golangci lint fix 2026-05-14 04:21:11 +03:00
zarazaex69
20f2c1397c feat: add timeout to openControlStream function 2026-05-13 22:07:34 +03:00
zarazaex69
68a144d6c0 feat: auto-fill engine/url from auth provider defaults
Each auth.Provider now declares DefaultServiceURL() so callers do not
need to know service-specific endpoints. ApplyAuthDefaults fills Engine
and URL from the provider before validation runs — explicit flags always
win, and providers with no default URL require -url to be set explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 15:23:20 +03:00
zarazaex69
f4ab63b5fa feat: wire WatchConnection into Dial — Read unblocks on session end
Dial now sets SetEndedCallback to close the pipe with ErrSessionEnded
and starts WatchConnection in a goroutine. Consumers (e.g. sing-box)
get a concrete error from Read when the session dies permanently.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 14:02:28 +03:00
zarazaex69
f287dc117a feat: expose CreateRoom in pkg/olcrtc public API
Add olcrtc.CreateRoom(ctx, authName) that delegates to the auth
provider's RoomCreator interface. Returns ErrRoomCreationUnsupported
for providers that don't support room creation (e.g. telemost).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 13:58:51 +03:00
zarazaex69
5078798204 feat: implement net.Conn via io.Pipe in pkg/olcrtc
Add conn.go wrapping Session as net.Conn: Read from pipe fed by OnData,
Write calls engine.Send, Close drains pipe and tears down session.
Add Session.Dial(ctx) as single-call connect-and-wrap entry point.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 13:55:49 +03:00
zarazaex69
0d9de3588d feat: add pkg/olcrtc — public library API
Exposes olcrtc as an embeddable Go library via pkg/olcrtc.Session.

Two usage modes:
  - Direct engine: caller supplies Engine+URL+Token, no HTTP auth flow.
  - Built-in auth: caller supplies Auth+RoomID; the registered auth
    provider (telemost, jazz, wbstream) resolves credentials internally.

Public surface:
  New(ctx, Config) (*Session, error)
  Session.Connect / Send / Close / WatchConnection
  Session.CanSend / SetEndedCallback / SetShouldReconnect
  RegisterDefaults() — pulls in all built-in engines + auth providers.

Also add !pkg/ exception to .gitignore (bare "olcrtc" pattern was
shadowing the new directory).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 13:49:19 +03:00