refactor(wire): переименовать srtpmimicry → rtpopus, заменить bool -obf на -obf-profile
Готовим зонтик `internal/wire/` под будущие профили мимикрии (rtph264, vp8 и т.д.). Сейчас интерфейс/registry не вводим — родится при появлении второго профиля; пока только перепаковываем единственный профиль в собственный namespace. Пакет: - `internal/wire/srtpmimicry` → `internal/wire/rtpopus` - error-префикс `"wrap: ..."` → `"rtpopus: ..."` - wire-формат не тронут (заморожен — совместимость с задеплоенными пирами) CLI (breaking): - `-obf` (bool) удалён - добавлен `-obf-profile none|rtpopus` (default `none`) - `ObfOpts.Mode bool` → `Profile ObfProfile` + `Enabled()` helper - консты `ObfProfileNone`/`ObfProfileRTPOpus` - validation invalid-value error для `-obf-profile` Docker (breaking): - env `OBF_MODE=true` → `OBF_PROFILE=rtpopus` Callsites: - `common.NewClientWrap` → `NewClientObf` - vars `wc`/`relayWC` → `obfConn`, `wrapListener` → `obfListener` - log `obf=%t` → `obf-profile=%s` Доки + тесты подтянуты под новые имена.
This commit is contained in:
1 parent
cf47f374b3
commit
4bedd00662
19 files changed
+179
-110
No files matched your search
@@ -14,14 +14,14 @@ import (
|
||||
"github.com/samosvalishe/btp/internal/stats"
|
||||
"github.com/samosvalishe/btp/internal/transport/dtlsdial"
|
||||
"github.com/samosvalishe/btp/internal/transport/kcptun"
|
||||
"github.com/samosvalishe/btp/internal/wire/srtpmimicry"
|
||||
"github.com/samosvalishe/btp/internal/wire/rtpopus"
|
||||
"github.com/xtaci/smux"
|
||||
)
|
||||
|
||||
// GetCredsFunc реэкспортирован из common, чтобы вызывающие не выходили за пределы импортов пакета.
|
||||
type GetCredsFunc = common.GetCredsFunc
|
||||
|
||||
// Params — конфигурация TURN/wrap для пула.
|
||||
// Params — конфигурация TURN/obf для пула.
|
||||
type Params struct {
|
||||
Host string
|
||||
Port string
|
||||
@@ -241,12 +241,12 @@ func createSmuxSession(ctx context.Context, deps *Deps, params *Params, peer *ne
|
||||
deps.log().Debugf("[session %d] TURN server IP: %s", id, stream.ServerUDPAddr.IP)
|
||||
deps.log().Debugf("relayed-address=%s", relayConn.LocalAddr().String())
|
||||
|
||||
relayWC, err := common.NewClientWrap(params.ObfKey)
|
||||
obfConn, err := common.NewClientObf(params.ObfKey)
|
||||
if err != nil {
|
||||
cleanup()
|
||||
return nil, nil, fmt.Errorf("wrap init: %w", err)
|
||||
return nil, nil, fmt.Errorf("obf init: %w", err)
|
||||
}
|
||||
dtlsPC := &srtpmimicry.RelayPacketConn{Relay: relayConn, Peer: peer, Conn: relayWC}
|
||||
dtlsPC := &rtpopus.RelayPacketConn{Relay: relayConn, Peer: peer, Conn: obfConn}
|
||||
dtlsConn, err := deps.DTLSDialer.Dial(ctx, dtlsPC, peer)
|
||||
if err != nil {
|
||||
cleanup()
|
||||
|
||||
Reference in new issue
Block a user