feat: add loopback outbound

Co-authored-by: Shelikhoo <xiaokangwang@outlook.com>
This commit is contained in:
AkinoKaede 2021-03-17 23:09:33 +08:00 committed by 秋のかえで
parent 9dec65e367
commit 98050aaf02
No known key found for this signature in database
GPG key ID: B208CDDD55BEF92C
7 changed files with 315 additions and 1 deletions

14
infra/conf/loopback.go Normal file
View file

@ -0,0 +1,14 @@
package conf
import (
"github.com/golang/protobuf/proto"
"github.com/xtls/xray-core/proxy/loopback"
)
type LoopbackConfig struct {
InboundTag string `json:"inboundTag"`
}
func (l LoopbackConfig) Build() (proto.Message, error) {
return &loopback.Config{InboundTag: l.InboundTag}, nil
}

View file

@ -2,11 +2,12 @@ package conf
import (
"encoding/json"
"github.com/xtls/xray-core/transport/internet"
"log"
"os"
"strings"
"github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/app/dispatcher"
"github.com/xtls/xray-core/app/proxyman"
"github.com/xtls/xray-core/app/stats"
@ -38,6 +39,7 @@ var (
"trojan": func() interface{} { return new(TrojanClientConfig) },
"mtproto": func() interface{} { return new(MTProtoClientConfig) },
"dns": func() interface{} { return new(DNSOutboundConfig) },
"loopback": func() interface{} { return new(LoopbackConfig) },
}, "protocol", "settings")
ctllog = log.New(os.Stderr, "xctl> ", 0)