feat: профиль freeturn vpn со вшитым wg и фикс ui_spin
- фикс вызова функций в ui_spin при наличии gum (устранена ошибка _dl: command not found) - поддержка поля wg в freeturn:// ссылках для автонастройки VPN в мобильном приложении - генерация отдельного профиля и выбор QR-кода со вшитым VPN в install.sh
This commit is contained in:
1 parent
2544be2ed6
commit
9da2c8ebd2
4 files changed
+51
-12
No files matched your search
@@ -103,6 +103,10 @@ func (r *raw) applyURI(u *uri.Config) {
|
||||
if u.ManualCaptcha {
|
||||
r.ManualCaptcha = true
|
||||
}
|
||||
if u.WGConf != "" {
|
||||
r.TunnelMode = "awg"
|
||||
r.TunnelConfig = u.WGConf
|
||||
}
|
||||
}
|
||||
|
||||
func assemble(r raw) (*Client, error) {
|
||||
|
||||
@@ -29,6 +29,7 @@ type Config struct {
|
||||
ManualCaptcha bool
|
||||
KCP *KCP
|
||||
Comment string
|
||||
WGConf string
|
||||
}
|
||||
|
||||
// wire - JSON-схема freeturn:// ссылок.
|
||||
@@ -49,6 +50,7 @@ type wire struct {
|
||||
ManualCaptcha bool `json:"mcap,omitempty"`
|
||||
KCP *KCP `json:"kcp,omitempty"`
|
||||
Name string `json:"name,omitempty"`
|
||||
WGConf string `json:"wg,omitempty"`
|
||||
}
|
||||
|
||||
// Parse разбирает строку freeturn://<base64url(json)>.
|
||||
@@ -97,6 +99,7 @@ func Parse(s string) (*Config, error) {
|
||||
ManualCaptcha: w.ManualCaptcha,
|
||||
KCP: w.KCP,
|
||||
Comment: w.Name,
|
||||
WGConf: w.WGConf,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -117,6 +120,7 @@ func (c *Config) String() string {
|
||||
ManualCaptcha: c.ManualCaptcha,
|
||||
KCP: c.KCP,
|
||||
Name: c.Comment,
|
||||
WGConf: c.WGConf,
|
||||
}
|
||||
if c.ObfProfile != "" && c.ObfProfile != "none" {
|
||||
w.Obf = c.ObfProfile
|
||||
|
||||
@@ -48,6 +48,16 @@ func TestRoundTrip(t *testing.T) {
|
||||
Comment: "Сервер РФ",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "with wg conf",
|
||||
cfg: &Config{
|
||||
Version: currentVersion,
|
||||
Provider: "vk",
|
||||
Peer: "1.2.3.4:56000",
|
||||
Comment: "VPN Server",
|
||||
WGConf: "[Interface]\nPrivateKey = test\n[Peer]\nPublicKey = test\n",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
Reference in new issue
Block a user