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
+4
-4
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/samosvalishe/btp/internal/proxy/tcpfwd"
|
||||
"github.com/samosvalishe/btp/internal/proxy/udprelay"
|
||||
"github.com/samosvalishe/btp/internal/transport/dtlsdial"
|
||||
"github.com/samosvalishe/btp/internal/wire/srtpmimicry"
|
||||
"github.com/samosvalishe/btp/internal/wire/rtpopus"
|
||||
)
|
||||
|
||||
// version is populated at build time via -ldflags "-X main.version=...".
|
||||
@@ -64,7 +64,7 @@ func main() {
|
||||
appDialer := dnsdial.AppDialer(cfg.DNS.Mode)
|
||||
dnsdial.InstallGlobalResolver(cfg.DNS.Mode)
|
||||
if cfg.Obf.GenKey {
|
||||
key, gerr := srtpmimicry.GenKeyHex()
|
||||
key, gerr := rtpopus.GenKeyHex()
|
||||
if gerr != nil {
|
||||
logger.Errorf("gen-obf-key: %v", gerr)
|
||||
os.Exit(1)
|
||||
@@ -77,8 +77,8 @@ func main() {
|
||||
logger.Errorf("resolve peer addr: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
if cfg.Obf.Mode {
|
||||
logger.Infof("OBF mode enabled: peer server must use matching -obf-key")
|
||||
if cfg.Obf.Enabled() {
|
||||
logger.Infof("OBF profile=%s: peer server must use matching -obf-profile and -obf-key", cfg.Obf.Profile)
|
||||
}
|
||||
|
||||
var connectedStreams atomic.Int32
|
||||
|
||||
Reference in new issue
Block a user