refactor(layout): переезд в cmd/, свернуть client/internal в internal/client
- server/main.go → cmd/vk-turn-server/main.go. Несёт остаточные правки сервера
(drop параметра useBond, убрано поле startup-лога).
- client/internal/{browserprofile,captcha,dnsdial,namegen,vkauth} →
internal/client/* (единая иерархия internal/; параллельное дерево
client/internal/ убрано). Все Go import-пути обновлены.
- .github/workflows/{ci,release}.yml, Dockerfile, README.md — пути сборки
переключены на ./cmd/vk-turn-client и ./cmd/vk-turn-server.
- README: убран устаревший пример "server -vless-bond" (флаг удалён ранее);
добавлены рецепты сборки .so для Android arm64 + Linux arm64/amd64 под
ручную упаковку для мобилок.
- internal/proxy/udp/udp.go, internal/config/config.go: обновлены устаревшие
ссылки client/internal/* в doc-комментариях.
- notes/GLOSSARY.md (новый, ~20 терминов): фиксирует DTLS-как-обфускацию,
wrap=AEAD-не-XOR, четыре значения "client", три значения "stream", пять
ортогональных переключателей "mode", заметки по сборке libvkturn.so, iSH,
хрупкость init globalBondRegistry и удаления флагов.
cmd/vk-turn-client/ намеренно оставлен вне этого коммита; сворачивается вместе
с извлечением ручной captcha в следующем коммите, т.к. переименование и правки
импортов manualcaptcha.* попадают в один файл.
Wire-форматы не тронуты. Поведение не изменено кроме уже закоммиченных
удалений CLI.
This commit is contained in:
1 parent
5b68683d41
commit
2167ba990b
30 files changed
+154
-1238
No files matched your search
@@ -0,0 +1,64 @@
|
||||
package vkauth
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
|
||||
"github.com/cacggghp/vk-turn-proxy/internal/client/browserprofile"
|
||||
"github.com/cacggghp/vk-turn-proxy/internal/client/captcha"
|
||||
|
||||
tlsclient "github.com/bogdanfinn/tls-client"
|
||||
)
|
||||
|
||||
// CaptchaSolveMode selects between auto-solving and manual-browser fallback.
|
||||
type CaptchaSolveMode int
|
||||
|
||||
const (
|
||||
CaptchaSolveModeAuto CaptchaSolveMode = iota
|
||||
CaptchaSolveModeManual
|
||||
)
|
||||
|
||||
// CaptchaSolveModeForAttempt picks the solver to use on a given retry attempt.
|
||||
// Returns (mode, true) when a mode is available, (_, false) when exhausted.
|
||||
func CaptchaSolveModeForAttempt(attempt int, manualOnly bool) (CaptchaSolveMode, bool) {
|
||||
if manualOnly {
|
||||
return CaptchaSolveModeManual, attempt == 0
|
||||
}
|
||||
switch attempt {
|
||||
case 0:
|
||||
return CaptchaSolveModeAuto, true
|
||||
case 1:
|
||||
return CaptchaSolveModeManual, true
|
||||
}
|
||||
return 0, false
|
||||
}
|
||||
|
||||
func CaptchaSolveModeLabel(mode CaptchaSolveMode) string {
|
||||
switch mode {
|
||||
case CaptchaSolveModeAuto:
|
||||
return "auto captcha"
|
||||
case CaptchaSolveModeManual:
|
||||
return "manual captcha"
|
||||
default:
|
||||
return "captcha"
|
||||
}
|
||||
}
|
||||
|
||||
// AutoSolveFunc returns a success_token for the captcha when solvable via the
|
||||
// in-page widget flow. Implementations must respect ctx cancellation.
|
||||
type AutoSolveFunc func(
|
||||
ctx context.Context,
|
||||
captchaErr *captcha.Error,
|
||||
streamID int,
|
||||
http tlsclient.HttpClient,
|
||||
profile browserprofile.Profile,
|
||||
) (token string, err error)
|
||||
|
||||
// ManualSolveFunc opens the local browser-based fallback. Returns either a
|
||||
// success_token (token != "") or a captcha_key, depending on which path the
|
||||
// VK error exposed.
|
||||
type ManualSolveFunc func(
|
||||
ctx context.Context,
|
||||
captchaErr *captcha.Error,
|
||||
dialer net.Dialer,
|
||||
) (token, key string, err error)
|
||||
Reference in new issue
Block a user