Add obfs 4 hysteria2

pull/4711/head
2dust 10 months ago
parent d76679c2b6
commit ff91a5dad9

@ -713,6 +713,7 @@ namespace v2rayN.Handler
profileItem.address = profileItem.address.TrimEx();
profileItem.id = profileItem.id.TrimEx();
profileItem.path = profileItem.path.TrimEx();
profileItem.network = string.Empty;
if (Utils.IsNullOrEmpty(profileItem.streamSecurity))

@ -283,6 +283,15 @@ namespace v2rayN.Handler
outbound.password = node.id;
if (!Utils.IsNullOrEmpty(node.path))
{
outbound.obfs = new()
{
type = "salamander",
password = node.path.TrimEx(),
};
}
outbound.up_mbps = _config.hysteriaItem.up_mbps > 0 ? _config.hysteriaItem.up_mbps : null;
outbound.down_mbps = _config.hysteriaItem.down_mbps > 0 ? _config.hysteriaItem.down_mbps : null;

@ -180,6 +180,11 @@ namespace v2rayN.Handler
{
dicQuery.Add("alpn", Utils.UrlEncode(item.alpn));
}
if (!Utils.IsNullOrEmpty(item.path))
{
dicQuery.Add("obfs", "salamander");
dicQuery.Add("obfs-password", Utils.UrlEncode(item.path));
}
dicQuery.Add("insecure", item.allowInsecure.ToLower() == "true" ? "1" : "0");
string query = "?" + string.Join("&", dicQuery.Select(x => x.Key + "=" + x.Value).ToArray());
@ -883,6 +888,7 @@ namespace v2rayN.Handler
var query = Utils.ParseQueryString(url.Query);
ResolveStdTransport(query, ref item);
item.path = Utils.UrlDecode(query["obfs-password"] ?? "");
item.allowInsecure = (query["insecure"] ?? "") == "1" ? "true" : "false";
return item;

@ -121,6 +121,7 @@
public Tls4Sbox tls { get; set; }
public Multiplex4Sbox multiplex { get; set; }
public Transport4Sbox transport { get; set; }
public HyObfs4Sbox obfs { get; set; }
}
public class Tls4Sbox
@ -174,6 +175,12 @@
public string? Host { get; set; }
}
public class HyObfs4Sbox
{
public string? type { get; set; }
public string? password { get; set; }
}
public class Server4Sbox
{
public string tag { get; set; }

@ -2185,6 +2185,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 obfs password 的本地化字符串。
/// </summary>
public static string TbPath7 {
get {
return ResourceManager.GetString("TbPath7", resourceCulture);
}
}
/// <summary>
/// 查找类似 Port 的本地化字符串。
/// </summary>

@ -1180,4 +1180,7 @@
<data name="TbLocalAddress" xml:space="preserve">
<value>Address(Ip,Ipv6)</value>
</data>
<data name="TbPath7" xml:space="preserve">
<value>obfs password</value>
</data>
</root>

@ -1177,4 +1177,7 @@
<data name="TbLocalAddress" xml:space="preserve">
<value>Address(Ip,Ipv6)</value>
</data>
<data name="TbPath7" xml:space="preserve">
<value>混淆密码(obfs password)</value>
</data>
</root>

@ -429,6 +429,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="180" />
@ -449,6 +450,21 @@
Width="400"
Margin="{StaticResource ServerItemMargin}"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="{StaticResource ServerItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbPath7}" />
<TextBox
x:Name="txtPath7"
Grid.Row="2"
Grid.Column="1"
Width="400"
Margin="{StaticResource ServerItemMargin}"
Style="{StaticResource DefTextBox}" />
</Grid>
<Grid
x:Name="gridTuic"

@ -191,6 +191,7 @@ namespace v2rayN.Views
case EConfigType.Hysteria2:
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId7.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSource.path, v => v.txtPath7.Text).DisposeWith(disposables);
break;
case EConfigType.Tuic:

Loading…
Cancel
Save