mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-07-11 14:18:53 +00:00
Add tun support
This commit is contained in:
@@ -410,6 +410,7 @@ type Config struct {
|
||||
Reverse *ReverseConfig `json:"reverse"`
|
||||
FakeDNS *FakeDNSConfig `json:"fakeDns"`
|
||||
Observatory *ObservatoryConfig `json:"observatory"`
|
||||
Tun *TunConfig `json:"tun"`
|
||||
}
|
||||
|
||||
func (c *Config) findInboundTag(tag string) int {
|
||||
@@ -474,6 +475,10 @@ func (c *Config) Override(o *Config, fn string) {
|
||||
c.Observatory = o.Observatory
|
||||
}
|
||||
|
||||
if o.Tun != nil {
|
||||
c.Tun = o.Tun
|
||||
}
|
||||
|
||||
// deprecated attrs... keep them for now
|
||||
if o.InboundConfig != nil {
|
||||
c.InboundConfig = o.InboundConfig
|
||||
@@ -637,6 +642,14 @@ func (c *Config) Build() (*core.Config, error) {
|
||||
config.App = append(config.App, serial.ToTypedMessage(r))
|
||||
}
|
||||
|
||||
if c.Tun != nil {
|
||||
r, err := c.Tun.Build()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
config.App = append(config.App, serial.ToTypedMessage(r))
|
||||
}
|
||||
|
||||
var inbounds []InboundDetourConfig
|
||||
|
||||
if c.InboundConfig != nil {
|
||||
|
||||
Reference in New Issue
Block a user