mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-19 13:42:24 +00:00
Enables dhcp interface configuration
This commit is contained in:
parent
f82ba4bc08
commit
ec29e87dd2
2 changed files with 12 additions and 5 deletions
|
@ -1,3 +1,5 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ServiceLib.Models;
|
||||
|
||||
public class SingboxConfig
|
||||
|
@ -226,7 +228,7 @@ public class Server4Sbox
|
|||
public string? type { get; set; }
|
||||
public string? server { get; set; }
|
||||
public string? server_resolver { get; set; }
|
||||
//public string? interface { get; set; }
|
||||
[JsonPropertyName("interface")] public string? Interface { get; set; }
|
||||
}
|
||||
|
||||
public class Experimental4Sbox
|
||||
|
|
|
@ -1314,7 +1314,7 @@ public class CoreConfigSingboxService
|
|||
var tag = "local_local";
|
||||
var localDnsAddress = string.IsNullOrEmpty(dNSItem?.DomainDNSAddress) ? Global.SingboxDomainDNSAddress.FirstOrDefault() : dNSItem?.DomainDNSAddress;
|
||||
string? localDnsType = null;
|
||||
//string? dhcpDnsInterface = null;
|
||||
string? dhcpDnsInterface = null;
|
||||
if (localDnsAddress == "local")
|
||||
{
|
||||
localDnsType = "local";
|
||||
|
@ -1323,8 +1323,12 @@ public class CoreConfigSingboxService
|
|||
else if (localDnsAddress.StartsWith("dhcp") && localDnsAddress.Length > 7)
|
||||
{
|
||||
localDnsType = "dhcp";
|
||||
// // dhcp://
|
||||
// dhcpDnsInterface = localDnsAddress.Substring(7);
|
||||
// dhcp://
|
||||
dhcpDnsInterface = localDnsAddress.Substring(7);
|
||||
if (dhcpDnsInterface == "auto")
|
||||
{
|
||||
dhcpDnsInterface = null;
|
||||
}
|
||||
localDnsAddress = null;
|
||||
}
|
||||
else if (localDnsAddress.StartsWith("tcp") && localDnsAddress.Length > 6)
|
||||
|
@ -1360,7 +1364,8 @@ public class CoreConfigSingboxService
|
|||
{
|
||||
tag = tag,
|
||||
type = localDnsType,
|
||||
server = localDnsAddress
|
||||
server = localDnsAddress,
|
||||
Interface = dhcpDnsInterface
|
||||
});
|
||||
dns4Sbox.rules.Insert(0, new()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue