TUN inbound: Add gateway, dns, autoSystemRoutingTable, autoOutboundsInterface for Windows (#5887)

And refactor `mtu` to support setting IPv4/v6 separately

Example: https://github.com/XTLS/Xray-core/pull/5887#issue-4198837696
This commit is contained in:
LjhAUMEM
2026-04-13 21:38:10 +08:00
committed by GitHub
parent f27edc3172
commit 806b8dc27d
16 changed files with 544 additions and 109 deletions
+15 -4
View File
@@ -3,6 +3,8 @@
package tun
import (
"net"
"github.com/xtls/xray-core/common/errors"
"gvisor.dev/gvisor/pkg/tcpip/stack"
)
@@ -13,11 +15,8 @@ type DefaultTun struct {
// DefaultTun implements Tun
var _ Tun = (*DefaultTun)(nil)
// DefaultTun implements GVisorTun
var _ GVisorTun = (*DefaultTun)(nil)
// NewTun builds new tun interface handler
func NewTun(options TunOptions) (Tun, error) {
func NewTun(options *Config) (Tun, error) {
return nil, errors.New("Tun is not supported on your platform")
}
@@ -29,6 +28,18 @@ func (t *DefaultTun) Close() error {
return errors.New("Tun is not supported on your platform")
}
func (t *DefaultTun) Name() (string, error) {
return "", errors.New("Tun is not supported on your platform")
}
func (t *DefaultTun) Index() (int, error) {
return 0, errors.New("Tun is not supported on your platform")
}
func (t *DefaultTun) newEndpoint() (stack.LinkEndpoint, error) {
return nil, errors.New("Tun is not supported on your platform")
}
func setinterface(string, string, uintptr, *net.Interface) error {
return errors.New("Tun is not supported on your platform")
}