1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-29 10:45:22 +00:00

prototype for new sniffing mechanism

This commit is contained in:
Darien Raymond 2018-07-16 13:47:00 +02:00
parent 8912e4eb90
commit c0e37ef34a
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
16 changed files with 363 additions and 532 deletions

View File

@ -4,6 +4,7 @@ package dispatcher
import ( import (
"context" "context"
"strings"
"time" "time"
"v2ray.com/core" "v2ray.com/core"
@ -135,6 +136,15 @@ func (d *DefaultDispatcher) getLink(ctx context.Context) (*core.Link, *core.Link
return inboundLink, outboundLink return inboundLink, outboundLink
} }
func shouldOverride(result SniffResult, domainOverride []string) bool {
for _, p := range domainOverride {
if strings.HasPrefix(result.Protocol(), p) {
return true
}
}
return false
}
// Dispatch implements core.Dispatcher. // Dispatch implements core.Dispatcher.
func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destination) (*core.Link, error) { func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destination) (*core.Link, error) {
if !destination.IsValid() { if !destination.IsValid() {
@ -143,8 +153,8 @@ func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destin
ctx = proxy.ContextWithTarget(ctx, destination) ctx = proxy.ContextWithTarget(ctx, destination)
inbound, outbound := d.getLink(ctx) inbound, outbound := d.getLink(ctx)
snifferList := proxyman.ProtocolSniffersFromContext(ctx) sniffingConfig := proxyman.SniffingConfigFromContext(ctx)
if destination.Address.Family().IsDomain() || destination.Network != net.Network_TCP || len(snifferList) == 0 { if destination.Network != net.Network_TCP || sniffingConfig == nil || !sniffingConfig.Enabled {
go d.routedDispatch(ctx, outbound, destination) go d.routedDispatch(ctx, outbound, destination)
} else { } else {
go func() { go func() {
@ -152,8 +162,12 @@ func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destin
reader: outbound.Reader.(*pipe.Reader), reader: outbound.Reader.(*pipe.Reader),
} }
outbound.Reader = cReader outbound.Reader = cReader
domain, err := sniffer(ctx, snifferList, cReader) result, err := sniffer(ctx, cReader)
if err == nil { if err == nil {
ctx = ContextWithSniffingResult(ctx, result)
}
if err == nil && shouldOverride(result, sniffingConfig.DomainOverride) {
domain := result.Domain()
newError("sniffed domain: ", domain).WriteToLog(session.ExportIDToError(ctx)) newError("sniffed domain: ", domain).WriteToLog(session.ExportIDToError(ctx))
destination.Address = net.ParseAddress(domain) destination.Address = net.ParseAddress(domain)
ctx = proxy.ContextWithTarget(ctx, destination) ctx = proxy.ContextWithTarget(ctx, destination)
@ -164,31 +178,31 @@ func (d *DefaultDispatcher) Dispatch(ctx context.Context, destination net.Destin
return inbound, nil return inbound, nil
} }
func sniffer(ctx context.Context, snifferList []proxyman.KnownProtocols, cReader *cachedReader) (string, error) { func sniffer(ctx context.Context, cReader *cachedReader) (SniffResult, error) {
payload := buf.New() payload := buf.New()
defer payload.Release() defer payload.Release()
sniffer := NewSniffer(snifferList) sniffer := NewSniffer()
totalAttempt := 0 totalAttempt := 0
for { for {
select { select {
case <-ctx.Done(): case <-ctx.Done():
return "", ctx.Err() return nil, ctx.Err()
default: default:
totalAttempt++ totalAttempt++
if totalAttempt > 5 { if totalAttempt > 5 {
return "", errSniffingTimeout return nil, errSniffingTimeout
} }
cReader.Cache(payload) cReader.Cache(payload)
if !payload.IsEmpty() { if !payload.IsEmpty() {
domain, err := sniffer.Sniff(payload.Bytes()) result, err := sniffer.Sniff(payload.Bytes())
if err != ErrMoreData { if err != core.ErrNoClue {
return domain, err return result, err
} }
} }
if payload.IsFull() { if payload.IsFull() {
return "", ErrInvalidData return nil, errUnknownContent
} }
time.Sleep(time.Millisecond * 100) time.Sleep(time.Millisecond * 100)
} }

View File

@ -1,3 +1,22 @@
package dispatcher package dispatcher
import "context"
//go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg dispatcher -path App,Dispatcher //go:generate go run $GOPATH/src/v2ray.com/core/common/errors/errorgen/main.go -pkg dispatcher -path App,Dispatcher
type key int
const (
sniffing key = iota
)
func ContextWithSniffingResult(ctx context.Context, r SniffResult) context.Context {
return context.WithValue(ctx, sniffing, r)
}
func SniffingResultFromContext(ctx context.Context) SniffResult {
if c, ok := ctx.Value(sniffing).(SniffResult); ok {
return c
}
return nil
}

View File

@ -1,215 +1,53 @@
package dispatcher package dispatcher
import ( import (
"bytes" "v2ray.com/core"
"strings" "v2ray.com/core/common/protocol/bittorrent"
"v2ray.com/core/common/protocol/http"
"v2ray.com/core/app/proxyman" "v2ray.com/core/common/protocol/tls"
"v2ray.com/core/common/serial"
) )
var ( type SniffResult interface {
ErrMoreData = newError("need more data") Protocol() string
ErrInvalidData = newError("invalid data") Domain() string
)
func ContainsValidHTTPMethod(b []byte) bool {
if len(b) == 0 {
return false
}
parts := bytes.Split(b, []byte{' '})
part0Trimed := strings.ToLower(string(bytes.Trim(parts[0], " ")))
return part0Trimed == "get" || part0Trimed == "post" ||
part0Trimed == "head" || part0Trimed == "put" ||
part0Trimed == "delete" || part0Trimed == "options" || part0Trimed == "connect"
} }
func SniffHTTP(b []byte) (string, error) { type protocolSniffer func([]byte) (SniffResult, error)
if len(b) == 0 {
return "", ErrMoreData
}
headers := bytes.Split(b, []byte{'\n'})
if !ContainsValidHTTPMethod(headers[0]) {
return "", ErrInvalidData
}
for i := 1; i < len(headers); i++ {
header := headers[i]
if len(header) == 0 {
return "", ErrInvalidData
}
parts := bytes.SplitN(header, []byte{':'}, 2)
if len(parts) != 2 {
return "", ErrInvalidData
}
key := strings.ToLower(string(parts[0]))
value := strings.ToLower(string(bytes.Trim(parts[1], " ")))
if key == "host" {
domain := strings.Split(value, ":")
return strings.TrimSpace(domain[0]), nil
}
}
return "", ErrMoreData
}
func IsValidTLSVersion(major, minor byte) bool {
return major == 3
}
// ReadClientHello returns server name (if any) from TLS client hello message.
// https://github.com/golang/go/blob/master/src/crypto/tls/handshake_messages.go#L300
func ReadClientHello(data []byte) (string, error) {
if len(data) < 42 {
return "", ErrMoreData
}
sessionIDLen := int(data[38])
if sessionIDLen > 32 || len(data) < 39+sessionIDLen {
return "", ErrInvalidData
}
data = data[39+sessionIDLen:]
if len(data) < 2 {
return "", ErrMoreData
}
// cipherSuiteLen is the number of bytes of cipher suite numbers. Since
// they are uint16s, the number must be even.
cipherSuiteLen := int(data[0])<<8 | int(data[1])
if cipherSuiteLen%2 == 1 || len(data) < 2+cipherSuiteLen {
return "", ErrInvalidData
}
data = data[2+cipherSuiteLen:]
if len(data) < 1 {
return "", ErrMoreData
}
compressionMethodsLen := int(data[0])
if len(data) < 1+compressionMethodsLen {
return "", ErrMoreData
}
data = data[1+compressionMethodsLen:]
if len(data) == 0 {
return "", ErrInvalidData
}
if len(data) < 2 {
return "", ErrInvalidData
}
extensionsLength := int(data[0])<<8 | int(data[1])
data = data[2:]
if extensionsLength != len(data) {
return "", ErrInvalidData
}
for len(data) != 0 {
if len(data) < 4 {
return "", ErrInvalidData
}
extension := uint16(data[0])<<8 | uint16(data[1])
length := int(data[2])<<8 | int(data[3])
data = data[4:]
if len(data) < length {
return "", ErrInvalidData
}
switch extension {
case 0x00: /* extensionServerName */
d := data[:length]
if len(d) < 2 {
return "", ErrInvalidData
}
namesLen := int(d[0])<<8 | int(d[1])
d = d[2:]
if len(d) != namesLen {
return "", ErrInvalidData
}
for len(d) > 0 {
if len(d) < 3 {
return "", ErrInvalidData
}
nameType := d[0]
nameLen := int(d[1])<<8 | int(d[2])
d = d[3:]
if len(d) < nameLen {
return "", ErrInvalidData
}
if nameType == 0 {
serverName := string(d[:nameLen])
// An SNI value may not include a
// trailing dot. See
// https://tools.ietf.org/html/rfc6066#section-3.
if strings.HasSuffix(serverName, ".") {
return "", ErrInvalidData
}
return serverName, nil
}
d = d[nameLen:]
}
}
data = data[length:]
}
return "", ErrInvalidData
}
func SniffTLS(b []byte) (string, error) {
if len(b) < 5 {
return "", ErrMoreData
}
if b[0] != 0x16 /* TLS Handshake */ {
return "", ErrInvalidData
}
if !IsValidTLSVersion(b[1], b[2]) {
return "", ErrInvalidData
}
headerLen := int(serial.BytesToUint16(b[3:5]))
if 5+headerLen > len(b) {
return "", ErrMoreData
}
return ReadClientHello(b[5 : 5+headerLen])
}
type Sniffer struct { type Sniffer struct {
slist []func([]byte) (string, error) sniffer []protocolSniffer
err []error
} }
func NewSniffer(snifferList []proxyman.KnownProtocols) *Sniffer { func NewSniffer() *Sniffer {
s := new(Sniffer) return &Sniffer{
sniffer: []protocolSniffer{
for _, protocol := range snifferList { func(b []byte) (SniffResult, error) { return http.SniffHTTP(b) },
var f func([]byte) (string, error) func(b []byte) (SniffResult, error) { return tls.SniffTLS(b) },
switch protocol { func(b []byte) (SniffResult, error) { return bittorrent.SniffBittorrent(b) },
case proxyman.KnownProtocols_HTTP: },
f = SniffHTTP
case proxyman.KnownProtocols_TLS:
f = SniffTLS
default:
panic("Unsupported protocol")
}
s.slist = append(s.slist, f)
} }
s.err = make([]error, len(s.slist))
return s
} }
func (s *Sniffer) Sniff(payload []byte) (string, error) { var errUnknownContent = newError("unknown content")
sniffed := false
for idx, sniffer := range s.slist { func (s *Sniffer) Sniff(payload []byte) (SniffResult, error) {
if s.err[idx] != nil { var pendingSniffer []protocolSniffer
for _, s := range s.sniffer {
result, err := s(payload)
if err == core.ErrNoClue {
pendingSniffer = append(pendingSniffer, s)
continue continue
} }
sniffed = true
domain, err := sniffer(payload) if err == nil && result != nil {
if err == nil { return result, nil
return domain, nil
}
if err != ErrMoreData {
s.err[idx] = err
} }
} }
if sniffed {
return "", ErrMoreData if len(pendingSniffer) > 0 {
s.sniffer = pendingSniffer
return nil, core.ErrNoClue
} }
return "", s.err[0]
return nil, errUnknownContent
} }

View File

@ -1,193 +0,0 @@
package dispatcher_test
import (
"testing"
. "v2ray.com/core/app/dispatcher"
"v2ray.com/core/app/proxyman"
. "v2ray.com/ext/assert"
)
func TestHTTPHeaders(t *testing.T) {
assert := With(t)
cases := []struct {
input string
domain string
err error
}{
{
input: `GET /tutorials/other/top-20-mysql-best-practices/ HTTP/1.1
Host: net.tutsplus.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cookie: PHPSESSID=r2t5uvjq435r4q7ib3vtdjq120
Pragma: no-cache
Cache-Control: no-cache`,
domain: "net.tutsplus.com",
err: nil,
},
{
input: `POST /foo.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/test.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 43
first_name=John&last_name=Doe&action=Submit`,
domain: "localhost",
err: nil,
},
{
input: `X /foo.php HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/test.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 43
first_name=John&last_name=Doe&action=Submit`,
domain: "",
err: ErrInvalidData,
},
{
input: `GET /foo.php HTTP/1.1
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/test.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 43
Host: localhost
first_name=John&last_name=Doe&action=Submit`,
domain: "",
err: ErrInvalidData,
},
{
input: `GET /tutorials/other/top-20-mysql-best-practices/ HTTP/1.1`,
domain: "",
err: ErrMoreData,
},
}
for _, test := range cases {
domain, err := SniffHTTP([]byte(test.input))
assert(domain, Equals, test.domain)
assert(err, Equals, test.err)
}
}
func TestTLSHeaders(t *testing.T) {
assert := With(t)
cases := []struct {
input []byte
domain string
err error
}{
{
input: []byte{
0x16, 0x03, 0x01, 0x00, 0xc8, 0x01, 0x00, 0x00,
0xc4, 0x03, 0x03, 0x1a, 0xac, 0xb2, 0xa8, 0xfe,
0xb4, 0x96, 0x04, 0x5b, 0xca, 0xf7, 0xc1, 0xf4,
0x2e, 0x53, 0x24, 0x6e, 0x34, 0x0c, 0x58, 0x36,
0x71, 0x97, 0x59, 0xe9, 0x41, 0x66, 0xe2, 0x43,
0xa0, 0x13, 0xb6, 0x00, 0x00, 0x20, 0x1a, 0x1a,
0xc0, 0x2b, 0xc0, 0x2f, 0xc0, 0x2c, 0xc0, 0x30,
0xcc, 0xa9, 0xcc, 0xa8, 0xcc, 0x14, 0xcc, 0x13,
0xc0, 0x13, 0xc0, 0x14, 0x00, 0x9c, 0x00, 0x9d,
0x00, 0x2f, 0x00, 0x35, 0x00, 0x0a, 0x01, 0x00,
0x00, 0x7b, 0xba, 0xba, 0x00, 0x00, 0xff, 0x01,
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00,
0x14, 0x00, 0x00, 0x11, 0x63, 0x2e, 0x73, 0x2d,
0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66,
0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x00, 0x17, 0x00,
0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x0d, 0x00,
0x14, 0x00, 0x12, 0x04, 0x03, 0x08, 0x04, 0x04,
0x01, 0x05, 0x03, 0x08, 0x05, 0x05, 0x01, 0x08,
0x06, 0x06, 0x01, 0x02, 0x01, 0x00, 0x05, 0x00,
0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12,
0x00, 0x00, 0x00, 0x10, 0x00, 0x0e, 0x00, 0x0c,
0x02, 0x68, 0x32, 0x08, 0x68, 0x74, 0x74, 0x70,
0x2f, 0x31, 0x2e, 0x31, 0x00, 0x0b, 0x00, 0x02,
0x01, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08,
0xaa, 0xaa, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18,
0xaa, 0xaa, 0x00, 0x01, 0x00,
},
domain: "c.s-microsoft.com",
err: nil,
},
{
input: []byte{
0x16, 0x03, 0x01, 0x00, 0xee, 0x01, 0x00, 0x00,
0xea, 0x03, 0x03, 0xe7, 0x91, 0x9e, 0x93, 0xca,
0x78, 0x1b, 0x3c, 0xe0, 0x65, 0x25, 0x58, 0xb5,
0x93, 0xe1, 0x0f, 0x85, 0xec, 0x9a, 0x66, 0x8e,
0x61, 0x82, 0x88, 0xc8, 0xfc, 0xae, 0x1e, 0xca,
0xd7, 0xa5, 0x63, 0x20, 0xbd, 0x1c, 0x00, 0x00,
0x8b, 0xee, 0x09, 0xe3, 0x47, 0x6a, 0x0e, 0x74,
0xb0, 0xbc, 0xa3, 0x02, 0xa7, 0x35, 0xe8, 0x85,
0x70, 0x7c, 0x7a, 0xf0, 0x00, 0xdf, 0x4a, 0xea,
0x87, 0x01, 0x14, 0x91, 0x00, 0x20, 0xea, 0xea,
0xc0, 0x2b, 0xc0, 0x2f, 0xc0, 0x2c, 0xc0, 0x30,
0xcc, 0xa9, 0xcc, 0xa8, 0xcc, 0x14, 0xcc, 0x13,
0xc0, 0x13, 0xc0, 0x14, 0x00, 0x9c, 0x00, 0x9d,
0x00, 0x2f, 0x00, 0x35, 0x00, 0x0a, 0x01, 0x00,
0x00, 0x81, 0x9a, 0x9a, 0x00, 0x00, 0xff, 0x01,
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00,
0x16, 0x00, 0x00, 0x13, 0x77, 0x77, 0x77, 0x30,
0x37, 0x2e, 0x63, 0x6c, 0x69, 0x63, 0x6b, 0x74,
0x61, 0x6c, 0x65, 0x2e, 0x6e, 0x65, 0x74, 0x00,
0x17, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00,
0x0d, 0x00, 0x14, 0x00, 0x12, 0x04, 0x03, 0x08,
0x04, 0x04, 0x01, 0x05, 0x03, 0x08, 0x05, 0x05,
0x01, 0x08, 0x06, 0x06, 0x01, 0x02, 0x01, 0x00,
0x05, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0e,
0x00, 0x0c, 0x02, 0x68, 0x32, 0x08, 0x68, 0x74,
0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31, 0x75, 0x50,
0x00, 0x00, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00,
0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x9a, 0x9a,
0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x8a, 0x8a,
0x00, 0x01, 0x00,
},
domain: "www07.clicktale.net",
err: nil,
},
}
for _, test := range cases {
domain, err := SniffTLS(test.input)
assert(domain, Equals, test.domain)
assert(err, Equals, test.err)
}
}
func TestUnknownSniffer(t *testing.T) {
assert := With(t)
assert(func() { NewSniffer([]proxyman.KnownProtocols{proxyman.KnownProtocols(-1)}) }, Panics)
}

View File

@ -13,3 +13,27 @@ func (s *AllocationStrategy) GetRefreshValue() uint32 {
} }
return s.Refresh.Value return s.Refresh.Value
} }
func (c *ReceiverConfig) GetEffectiveSniffingSettings() *SniffingConfig {
if c.SniffingSettings != nil {
return c.SniffingSettings
}
if len(c.DomainOverride) > 0 {
var p []string
for _, kd := range c.DomainOverride {
switch kd {
case KnownProtocols_HTTP:
p = append(p, "http")
case KnownProtocols_TLS:
p = append(p, "tls")
}
}
return &SniffingConfig{
Enabled: true,
DomainOverride: p,
}
}
return nil
}

View File

@ -38,7 +38,7 @@ func (x KnownProtocols) String() string {
return proto.EnumName(KnownProtocols_name, int32(x)) return proto.EnumName(KnownProtocols_name, int32(x))
} }
func (KnownProtocols) EnumDescriptor() ([]byte, []int) { func (KnownProtocols) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_config_8038bf3f86761ebe, []int{0} return fileDescriptor_config_bab73170eded8a95, []int{0}
} }
type AllocationStrategy_Type int32 type AllocationStrategy_Type int32
@ -67,7 +67,7 @@ func (x AllocationStrategy_Type) String() string {
return proto.EnumName(AllocationStrategy_Type_name, int32(x)) return proto.EnumName(AllocationStrategy_Type_name, int32(x))
} }
func (AllocationStrategy_Type) EnumDescriptor() ([]byte, []int) { func (AllocationStrategy_Type) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_config_8038bf3f86761ebe, []int{1, 0} return fileDescriptor_config_bab73170eded8a95, []int{1, 0}
} }
type InboundConfig struct { type InboundConfig struct {
@ -80,7 +80,7 @@ func (m *InboundConfig) Reset() { *m = InboundConfig{} }
func (m *InboundConfig) String() string { return proto.CompactTextString(m) } func (m *InboundConfig) String() string { return proto.CompactTextString(m) }
func (*InboundConfig) ProtoMessage() {} func (*InboundConfig) ProtoMessage() {}
func (*InboundConfig) Descriptor() ([]byte, []int) { func (*InboundConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_config_8038bf3f86761ebe, []int{0} return fileDescriptor_config_bab73170eded8a95, []int{0}
} }
func (m *InboundConfig) XXX_Unmarshal(b []byte) error { func (m *InboundConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_InboundConfig.Unmarshal(m, b) return xxx_messageInfo_InboundConfig.Unmarshal(m, b)
@ -117,7 +117,7 @@ func (m *AllocationStrategy) Reset() { *m = AllocationStrategy{} }
func (m *AllocationStrategy) String() string { return proto.CompactTextString(m) } func (m *AllocationStrategy) String() string { return proto.CompactTextString(m) }
func (*AllocationStrategy) ProtoMessage() {} func (*AllocationStrategy) ProtoMessage() {}
func (*AllocationStrategy) Descriptor() ([]byte, []int) { func (*AllocationStrategy) Descriptor() ([]byte, []int) {
return fileDescriptor_config_8038bf3f86761ebe, []int{1} return fileDescriptor_config_bab73170eded8a95, []int{1}
} }
func (m *AllocationStrategy) XXX_Unmarshal(b []byte) error { func (m *AllocationStrategy) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AllocationStrategy.Unmarshal(m, b) return xxx_messageInfo_AllocationStrategy.Unmarshal(m, b)
@ -173,7 +173,7 @@ func (m *AllocationStrategy_AllocationStrategyConcurrency) String() string {
} }
func (*AllocationStrategy_AllocationStrategyConcurrency) ProtoMessage() {} func (*AllocationStrategy_AllocationStrategyConcurrency) ProtoMessage() {}
func (*AllocationStrategy_AllocationStrategyConcurrency) Descriptor() ([]byte, []int) { func (*AllocationStrategy_AllocationStrategyConcurrency) Descriptor() ([]byte, []int) {
return fileDescriptor_config_8038bf3f86761ebe, []int{1, 0} return fileDescriptor_config_bab73170eded8a95, []int{1, 0}
} }
func (m *AllocationStrategy_AllocationStrategyConcurrency) XXX_Unmarshal(b []byte) error { func (m *AllocationStrategy_AllocationStrategyConcurrency) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AllocationStrategy_AllocationStrategyConcurrency.Unmarshal(m, b) return xxx_messageInfo_AllocationStrategy_AllocationStrategyConcurrency.Unmarshal(m, b)
@ -215,7 +215,7 @@ func (m *AllocationStrategy_AllocationStrategyRefresh) String() string {
} }
func (*AllocationStrategy_AllocationStrategyRefresh) ProtoMessage() {} func (*AllocationStrategy_AllocationStrategyRefresh) ProtoMessage() {}
func (*AllocationStrategy_AllocationStrategyRefresh) Descriptor() ([]byte, []int) { func (*AllocationStrategy_AllocationStrategyRefresh) Descriptor() ([]byte, []int) {
return fileDescriptor_config_8038bf3f86761ebe, []int{1, 1} return fileDescriptor_config_bab73170eded8a95, []int{1, 1}
} }
func (m *AllocationStrategy_AllocationStrategyRefresh) XXX_Unmarshal(b []byte) error { func (m *AllocationStrategy_AllocationStrategyRefresh) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AllocationStrategy_AllocationStrategyRefresh.Unmarshal(m, b) return xxx_messageInfo_AllocationStrategy_AllocationStrategyRefresh.Unmarshal(m, b)
@ -242,6 +242,55 @@ func (m *AllocationStrategy_AllocationStrategyRefresh) GetValue() uint32 {
return 0 return 0
} }
type SniffingConfig struct {
// Whether or not to enable content sniffing on an inbound connection.
Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
// Override target domain if sniff'ed protocol is in the given list.
// Supported values are "http", "tls".
DomainOverride []string `protobuf:"bytes,2,rep,name=domain_override,json=domainOverride,proto3" json:"domain_override,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *SniffingConfig) Reset() { *m = SniffingConfig{} }
func (m *SniffingConfig) String() string { return proto.CompactTextString(m) }
func (*SniffingConfig) ProtoMessage() {}
func (*SniffingConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_config_bab73170eded8a95, []int{2}
}
func (m *SniffingConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SniffingConfig.Unmarshal(m, b)
}
func (m *SniffingConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SniffingConfig.Marshal(b, m, deterministic)
}
func (dst *SniffingConfig) XXX_Merge(src proto.Message) {
xxx_messageInfo_SniffingConfig.Merge(dst, src)
}
func (m *SniffingConfig) XXX_Size() int {
return xxx_messageInfo_SniffingConfig.Size(m)
}
func (m *SniffingConfig) XXX_DiscardUnknown() {
xxx_messageInfo_SniffingConfig.DiscardUnknown(m)
}
var xxx_messageInfo_SniffingConfig proto.InternalMessageInfo
func (m *SniffingConfig) GetEnabled() bool {
if m != nil {
return m.Enabled
}
return false
}
func (m *SniffingConfig) GetDomainOverride() []string {
if m != nil {
return m.DomainOverride
}
return nil
}
type ReceiverConfig struct { type ReceiverConfig struct {
// PortRange specifies the ports which the Receiver should listen on. // PortRange specifies the ports which the Receiver should listen on.
PortRange *net.PortRange `protobuf:"bytes,1,opt,name=port_range,json=portRange,proto3" json:"port_range,omitempty"` PortRange *net.PortRange `protobuf:"bytes,1,opt,name=port_range,json=portRange,proto3" json:"port_range,omitempty"`
@ -250,17 +299,20 @@ type ReceiverConfig struct {
AllocationStrategy *AllocationStrategy `protobuf:"bytes,3,opt,name=allocation_strategy,json=allocationStrategy,proto3" json:"allocation_strategy,omitempty"` AllocationStrategy *AllocationStrategy `protobuf:"bytes,3,opt,name=allocation_strategy,json=allocationStrategy,proto3" json:"allocation_strategy,omitempty"`
StreamSettings *internet.StreamConfig `protobuf:"bytes,4,opt,name=stream_settings,json=streamSettings,proto3" json:"stream_settings,omitempty"` StreamSettings *internet.StreamConfig `protobuf:"bytes,4,opt,name=stream_settings,json=streamSettings,proto3" json:"stream_settings,omitempty"`
ReceiveOriginalDestination bool `protobuf:"varint,5,opt,name=receive_original_destination,json=receiveOriginalDestination,proto3" json:"receive_original_destination,omitempty"` ReceiveOriginalDestination bool `protobuf:"varint,5,opt,name=receive_original_destination,json=receiveOriginalDestination,proto3" json:"receive_original_destination,omitempty"`
DomainOverride []KnownProtocols `protobuf:"varint,7,rep,packed,name=domain_override,json=domainOverride,proto3,enum=v2ray.core.app.proxyman.KnownProtocols" json:"domain_override,omitempty"` // Override domains for the given protocol.
XXX_NoUnkeyedLiteral struct{} `json:"-"` // Deprecated. Use sniffing_settings.
XXX_unrecognized []byte `json:"-"` DomainOverride []KnownProtocols `protobuf:"varint,7,rep,packed,name=domain_override,json=domainOverride,proto3,enum=v2ray.core.app.proxyman.KnownProtocols" json:"domain_override,omitempty"` // Deprecated: Do not use.
XXX_sizecache int32 `json:"-"` SniffingSettings *SniffingConfig `protobuf:"bytes,8,opt,name=sniffing_settings,json=sniffingSettings,proto3" json:"sniffing_settings,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *ReceiverConfig) Reset() { *m = ReceiverConfig{} } func (m *ReceiverConfig) Reset() { *m = ReceiverConfig{} }
func (m *ReceiverConfig) String() string { return proto.CompactTextString(m) } func (m *ReceiverConfig) String() string { return proto.CompactTextString(m) }
func (*ReceiverConfig) ProtoMessage() {} func (*ReceiverConfig) ProtoMessage() {}
func (*ReceiverConfig) Descriptor() ([]byte, []int) { func (*ReceiverConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_config_8038bf3f86761ebe, []int{2} return fileDescriptor_config_bab73170eded8a95, []int{3}
} }
func (m *ReceiverConfig) XXX_Unmarshal(b []byte) error { func (m *ReceiverConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ReceiverConfig.Unmarshal(m, b) return xxx_messageInfo_ReceiverConfig.Unmarshal(m, b)
@ -315,6 +367,7 @@ func (m *ReceiverConfig) GetReceiveOriginalDestination() bool {
return false return false
} }
// Deprecated: Do not use.
func (m *ReceiverConfig) GetDomainOverride() []KnownProtocols { func (m *ReceiverConfig) GetDomainOverride() []KnownProtocols {
if m != nil { if m != nil {
return m.DomainOverride return m.DomainOverride
@ -322,6 +375,13 @@ func (m *ReceiverConfig) GetDomainOverride() []KnownProtocols {
return nil return nil
} }
func (m *ReceiverConfig) GetSniffingSettings() *SniffingConfig {
if m != nil {
return m.SniffingSettings
}
return nil
}
type InboundHandlerConfig struct { type InboundHandlerConfig struct {
Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"` Tag string `protobuf:"bytes,1,opt,name=tag,proto3" json:"tag,omitempty"`
ReceiverSettings *serial.TypedMessage `protobuf:"bytes,2,opt,name=receiver_settings,json=receiverSettings,proto3" json:"receiver_settings,omitempty"` ReceiverSettings *serial.TypedMessage `protobuf:"bytes,2,opt,name=receiver_settings,json=receiverSettings,proto3" json:"receiver_settings,omitempty"`
@ -335,7 +395,7 @@ func (m *InboundHandlerConfig) Reset() { *m = InboundHandlerConfig{} }
func (m *InboundHandlerConfig) String() string { return proto.CompactTextString(m) } func (m *InboundHandlerConfig) String() string { return proto.CompactTextString(m) }
func (*InboundHandlerConfig) ProtoMessage() {} func (*InboundHandlerConfig) ProtoMessage() {}
func (*InboundHandlerConfig) Descriptor() ([]byte, []int) { func (*InboundHandlerConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_config_8038bf3f86761ebe, []int{3} return fileDescriptor_config_bab73170eded8a95, []int{4}
} }
func (m *InboundHandlerConfig) XXX_Unmarshal(b []byte) error { func (m *InboundHandlerConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_InboundHandlerConfig.Unmarshal(m, b) return xxx_messageInfo_InboundHandlerConfig.Unmarshal(m, b)
@ -386,7 +446,7 @@ func (m *OutboundConfig) Reset() { *m = OutboundConfig{} }
func (m *OutboundConfig) String() string { return proto.CompactTextString(m) } func (m *OutboundConfig) String() string { return proto.CompactTextString(m) }
func (*OutboundConfig) ProtoMessage() {} func (*OutboundConfig) ProtoMessage() {}
func (*OutboundConfig) Descriptor() ([]byte, []int) { func (*OutboundConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_config_8038bf3f86761ebe, []int{4} return fileDescriptor_config_bab73170eded8a95, []int{5}
} }
func (m *OutboundConfig) XXX_Unmarshal(b []byte) error { func (m *OutboundConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OutboundConfig.Unmarshal(m, b) return xxx_messageInfo_OutboundConfig.Unmarshal(m, b)
@ -421,7 +481,7 @@ func (m *SenderConfig) Reset() { *m = SenderConfig{} }
func (m *SenderConfig) String() string { return proto.CompactTextString(m) } func (m *SenderConfig) String() string { return proto.CompactTextString(m) }
func (*SenderConfig) ProtoMessage() {} func (*SenderConfig) ProtoMessage() {}
func (*SenderConfig) Descriptor() ([]byte, []int) { func (*SenderConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_config_8038bf3f86761ebe, []int{5} return fileDescriptor_config_bab73170eded8a95, []int{6}
} }
func (m *SenderConfig) XXX_Unmarshal(b []byte) error { func (m *SenderConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SenderConfig.Unmarshal(m, b) return xxx_messageInfo_SenderConfig.Unmarshal(m, b)
@ -483,7 +543,7 @@ func (m *MultiplexingConfig) Reset() { *m = MultiplexingConfig{} }
func (m *MultiplexingConfig) String() string { return proto.CompactTextString(m) } func (m *MultiplexingConfig) String() string { return proto.CompactTextString(m) }
func (*MultiplexingConfig) ProtoMessage() {} func (*MultiplexingConfig) ProtoMessage() {}
func (*MultiplexingConfig) Descriptor() ([]byte, []int) { func (*MultiplexingConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_config_8038bf3f86761ebe, []int{6} return fileDescriptor_config_bab73170eded8a95, []int{7}
} }
func (m *MultiplexingConfig) XXX_Unmarshal(b []byte) error { func (m *MultiplexingConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MultiplexingConfig.Unmarshal(m, b) return xxx_messageInfo_MultiplexingConfig.Unmarshal(m, b)
@ -522,6 +582,7 @@ func init() {
proto.RegisterType((*AllocationStrategy)(nil), "v2ray.core.app.proxyman.AllocationStrategy") proto.RegisterType((*AllocationStrategy)(nil), "v2ray.core.app.proxyman.AllocationStrategy")
proto.RegisterType((*AllocationStrategy_AllocationStrategyConcurrency)(nil), "v2ray.core.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency") proto.RegisterType((*AllocationStrategy_AllocationStrategyConcurrency)(nil), "v2ray.core.app.proxyman.AllocationStrategy.AllocationStrategyConcurrency")
proto.RegisterType((*AllocationStrategy_AllocationStrategyRefresh)(nil), "v2ray.core.app.proxyman.AllocationStrategy.AllocationStrategyRefresh") proto.RegisterType((*AllocationStrategy_AllocationStrategyRefresh)(nil), "v2ray.core.app.proxyman.AllocationStrategy.AllocationStrategyRefresh")
proto.RegisterType((*SniffingConfig)(nil), "v2ray.core.app.proxyman.SniffingConfig")
proto.RegisterType((*ReceiverConfig)(nil), "v2ray.core.app.proxyman.ReceiverConfig") proto.RegisterType((*ReceiverConfig)(nil), "v2ray.core.app.proxyman.ReceiverConfig")
proto.RegisterType((*InboundHandlerConfig)(nil), "v2ray.core.app.proxyman.InboundHandlerConfig") proto.RegisterType((*InboundHandlerConfig)(nil), "v2ray.core.app.proxyman.InboundHandlerConfig")
proto.RegisterType((*OutboundConfig)(nil), "v2ray.core.app.proxyman.OutboundConfig") proto.RegisterType((*OutboundConfig)(nil), "v2ray.core.app.proxyman.OutboundConfig")
@ -532,58 +593,61 @@ func init() {
} }
func init() { func init() {
proto.RegisterFile("v2ray.com/core/app/proxyman/config.proto", fileDescriptor_config_8038bf3f86761ebe) proto.RegisterFile("v2ray.com/core/app/proxyman/config.proto", fileDescriptor_config_bab73170eded8a95)
} }
var fileDescriptor_config_8038bf3f86761ebe = []byte{ var fileDescriptor_config_bab73170eded8a95 = []byte{
// 772 bytes of a gzipped FileDescriptorProto // 819 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0x5f, 0x6f, 0xeb, 0x34, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x95, 0x41, 0x6f, 0xe3, 0x44,
0x18, 0xc6, 0x4f, 0x9a, 0x9e, 0xb6, 0xe7, 0xdd, 0x69, 0x96, 0x63, 0x26, 0xad, 0x14, 0x90, 0x4a, 0x14, 0xc7, 0x37, 0x71, 0xb6, 0x49, 0x5f, 0xb7, 0xae, 0x3b, 0xac, 0xb4, 0x26, 0x80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 0x9f, 0x02, 0xa7,
0x95, 0x07, 0x00, 0x00, 0xf3, 0xea, 0x04, 0x3e, 0x8a, 0x44, 0xd6, 0xd6, 0xfb, 0xac, 0xf3, 0x76, 0xd0, 0xac, 0xff, 0xe8,
0x3e, 0xfb, 0x65, 0x8a, 0x49, 0xe1, 0x9d, 0x94, 0xaa, 0xe3, 0x3c, 0x37, 0x4e, 0x65, 0x84, 0x5f,
0xee, 0x54, 0x9f, 0xd3, 0x97, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xb9, 0x88, 0x8f, 0xff, 0x44,
0x08, 0x00, 0x00,
} }

View File

@ -51,6 +51,15 @@ enum KnownProtocols {
TLS = 1; TLS = 1;
} }
message SniffingConfig {
// Whether or not to enable content sniffing on an inbound connection.
bool enabled = 1;
// Override target domain if sniff'ed protocol is in the given list.
// Supported values are "http", "tls".
repeated string domain_override = 2;
}
message ReceiverConfig { message ReceiverConfig {
// PortRange specifies the ports which the Receiver should listen on. // PortRange specifies the ports which the Receiver should listen on.
v2ray.core.common.net.PortRange port_range = 1; v2ray.core.common.net.PortRange port_range = 1;
@ -60,7 +69,10 @@ message ReceiverConfig {
v2ray.core.transport.internet.StreamConfig stream_settings = 4; v2ray.core.transport.internet.StreamConfig stream_settings = 4;
bool receive_original_destination = 5; bool receive_original_destination = 5;
reserved 6; reserved 6;
repeated KnownProtocols domain_override = 7; // Override domains for the given protocol.
// Deprecated. Use sniffing_settings.
repeated KnownProtocols domain_override = 7 [deprecated = true];
SniffingConfig sniffing_settings = 8;
} }
message InboundHandlerConfig { message InboundHandlerConfig {

View File

@ -79,7 +79,7 @@ func NewAlwaysOnInboundHandler(ctx context.Context, tag string, receiverConfig *
recvOrigDest: receiverConfig.ReceiveOriginalDestination, recvOrigDest: receiverConfig.ReceiveOriginalDestination,
tag: tag, tag: tag,
dispatcher: h.mux, dispatcher: h.mux,
sniffers: receiverConfig.DomainOverride, sniffingConfig: receiverConfig.GetEffectiveSniffingSettings(),
uplinkCounter: uplinkCounter, uplinkCounter: uplinkCounter,
downlinkCounter: downlinkCounter, downlinkCounter: downlinkCounter,
} }

View File

@ -113,7 +113,7 @@ func (h *DynamicInboundHandler) refresh() error {
stream: h.receiverConfig.StreamSettings, stream: h.receiverConfig.StreamSettings,
recvOrigDest: h.receiverConfig.ReceiveOriginalDestination, recvOrigDest: h.receiverConfig.ReceiveOriginalDestination,
dispatcher: h.mux, dispatcher: h.mux,
sniffers: h.receiverConfig.DomainOverride, sniffingConfig: h.receiverConfig.GetEffectiveSniffingSettings(),
uplinkCounter: uplinkCounter, uplinkCounter: uplinkCounter,
downlinkCounter: downlinkCounter, downlinkCounter: downlinkCounter,
} }

View File

@ -37,7 +37,7 @@ type tcpWorker struct {
recvOrigDest bool recvOrigDest bool
tag string tag string
dispatcher core.Dispatcher dispatcher core.Dispatcher
sniffers []proxyman.KnownProtocols sniffingConfig *proxyman.SniffingConfig
uplinkCounter core.StatCounter uplinkCounter core.StatCounter
downlinkCounter core.StatCounter downlinkCounter core.StatCounter
@ -63,8 +63,8 @@ func (w *tcpWorker) callback(conn internet.Connection) {
} }
ctx = proxy.ContextWithInboundEntryPoint(ctx, net.TCPDestination(w.address, w.port)) ctx = proxy.ContextWithInboundEntryPoint(ctx, net.TCPDestination(w.address, w.port))
ctx = proxy.ContextWithSource(ctx, net.DestinationFromAddr(conn.RemoteAddr())) ctx = proxy.ContextWithSource(ctx, net.DestinationFromAddr(conn.RemoteAddr()))
if len(w.sniffers) > 0 { if w.sniffingConfig != nil {
ctx = proxyman.ContextWithProtocolSniffers(ctx, w.sniffers) ctx = proxyman.ContextWithSniffingConfig(ctx, w.sniffingConfig)
} }
if w.uplinkCounter != nil || w.downlinkCounter != nil { if w.uplinkCounter != nil || w.downlinkCounter != nil {
conn = &internet.StatCouterConnection{ conn = &internet.StatCouterConnection{

View File

@ -8,16 +8,16 @@ import (
type key int type key int
const ( const (
protocolsKey key = iota sniffing key = iota
) )
func ContextWithProtocolSniffers(ctx context.Context, list []KnownProtocols) context.Context { func ContextWithSniffingConfig(ctx context.Context, c *SniffingConfig) context.Context {
return context.WithValue(ctx, protocolsKey, list) return context.WithValue(ctx, sniffing, c)
} }
func ProtocolSniffersFromContext(ctx context.Context) []KnownProtocols { func SniffingConfigFromContext(ctx context.Context) *SniffingConfig {
if list, ok := ctx.Value(protocolsKey).([]KnownProtocols); ok { if c, ok := ctx.Value(sniffing).(*SniffingConfig); ok {
return list return c
} }
return nil return nil
} }

View File

@ -2,9 +2,11 @@ package router
import ( import (
"context" "context"
"strings"
"sync" "sync"
"time" "time"
"v2ray.com/core/app/dispatcher"
"v2ray.com/core/common/net" "v2ray.com/core/common/net"
"v2ray.com/core/common/protocol" "v2ray.com/core/common/protocol"
"v2ray.com/core/common/strmatcher" "v2ray.com/core/common/strmatcher"
@ -372,3 +374,38 @@ func (v *InboundTagMatcher) Apply(ctx context.Context) bool {
} }
return false return false
} }
type ProtocolMatcher struct {
protocols []string
}
func NewProtocolMatcher(protocols []string) *ProtocolMatcher {
pCopy := make([]string, 0, len(protocols))
for _, p := range protocols {
if len(p) > 0 {
pCopy = append(pCopy, p)
}
}
return &ProtocolMatcher{
protocols: pCopy,
}
}
func (m *ProtocolMatcher) Apply(ctx context.Context) bool {
result := dispatcher.SniffingResultFromContext(ctx)
if result == nil {
return false
}
protocol := result.Protocol()
for _, p := range m.protocols {
if strings.HasPrefix(protocol, p) {
return true
}
}
return false
}

View File

@ -91,6 +91,10 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
conds.Add(cond) conds.Add(cond)
} }
if len(rr.Protocol) > 0 {
conds.Add(NewProtocolMatcher(rr.Protocol))
}
if conds.Len() == 0 { if conds.Len() == 0 {
return nil, newError("this rule has no effective fields").AtWarning() return nil, newError("this rule has no effective fields").AtWarning()
} }

View File

@ -43,7 +43,7 @@ func (x Domain_Type) String() string {
return proto.EnumName(Domain_Type_name, int32(x)) return proto.EnumName(Domain_Type_name, int32(x))
} }
func (Domain_Type) EnumDescriptor() ([]byte, []int) { func (Domain_Type) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_config_bdac2d1c90ceb42f, []int{0, 0} return fileDescriptor_config_38b171a67be39168, []int{0, 0}
} }
type Config_DomainStrategy int32 type Config_DomainStrategy int32
@ -76,7 +76,7 @@ func (x Config_DomainStrategy) String() string {
return proto.EnumName(Config_DomainStrategy_name, int32(x)) return proto.EnumName(Config_DomainStrategy_name, int32(x))
} }
func (Config_DomainStrategy) EnumDescriptor() ([]byte, []int) { func (Config_DomainStrategy) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_config_bdac2d1c90ceb42f, []int{7, 0} return fileDescriptor_config_38b171a67be39168, []int{7, 0}
} }
// Domain for routing decision. // Domain for routing decision.
@ -94,7 +94,7 @@ func (m *Domain) Reset() { *m = Domain{} }
func (m *Domain) String() string { return proto.CompactTextString(m) } func (m *Domain) String() string { return proto.CompactTextString(m) }
func (*Domain) ProtoMessage() {} func (*Domain) ProtoMessage() {}
func (*Domain) Descriptor() ([]byte, []int) { func (*Domain) Descriptor() ([]byte, []int) {
return fileDescriptor_config_bdac2d1c90ceb42f, []int{0} return fileDescriptor_config_38b171a67be39168, []int{0}
} }
func (m *Domain) XXX_Unmarshal(b []byte) error { func (m *Domain) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Domain.Unmarshal(m, b) return xxx_messageInfo_Domain.Unmarshal(m, b)
@ -143,7 +143,7 @@ func (m *CIDR) Reset() { *m = CIDR{} }
func (m *CIDR) String() string { return proto.CompactTextString(m) } func (m *CIDR) String() string { return proto.CompactTextString(m) }
func (*CIDR) ProtoMessage() {} func (*CIDR) ProtoMessage() {}
func (*CIDR) Descriptor() ([]byte, []int) { func (*CIDR) Descriptor() ([]byte, []int) {
return fileDescriptor_config_bdac2d1c90ceb42f, []int{1} return fileDescriptor_config_38b171a67be39168, []int{1}
} }
func (m *CIDR) XXX_Unmarshal(b []byte) error { func (m *CIDR) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CIDR.Unmarshal(m, b) return xxx_messageInfo_CIDR.Unmarshal(m, b)
@ -189,7 +189,7 @@ func (m *GeoIP) Reset() { *m = GeoIP{} }
func (m *GeoIP) String() string { return proto.CompactTextString(m) } func (m *GeoIP) String() string { return proto.CompactTextString(m) }
func (*GeoIP) ProtoMessage() {} func (*GeoIP) ProtoMessage() {}
func (*GeoIP) Descriptor() ([]byte, []int) { func (*GeoIP) Descriptor() ([]byte, []int) {
return fileDescriptor_config_bdac2d1c90ceb42f, []int{2} return fileDescriptor_config_38b171a67be39168, []int{2}
} }
func (m *GeoIP) XXX_Unmarshal(b []byte) error { func (m *GeoIP) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GeoIP.Unmarshal(m, b) return xxx_messageInfo_GeoIP.Unmarshal(m, b)
@ -234,7 +234,7 @@ func (m *GeoIPList) Reset() { *m = GeoIPList{} }
func (m *GeoIPList) String() string { return proto.CompactTextString(m) } func (m *GeoIPList) String() string { return proto.CompactTextString(m) }
func (*GeoIPList) ProtoMessage() {} func (*GeoIPList) ProtoMessage() {}
func (*GeoIPList) Descriptor() ([]byte, []int) { func (*GeoIPList) Descriptor() ([]byte, []int) {
return fileDescriptor_config_bdac2d1c90ceb42f, []int{3} return fileDescriptor_config_38b171a67be39168, []int{3}
} }
func (m *GeoIPList) XXX_Unmarshal(b []byte) error { func (m *GeoIPList) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GeoIPList.Unmarshal(m, b) return xxx_messageInfo_GeoIPList.Unmarshal(m, b)
@ -273,7 +273,7 @@ func (m *GeoSite) Reset() { *m = GeoSite{} }
func (m *GeoSite) String() string { return proto.CompactTextString(m) } func (m *GeoSite) String() string { return proto.CompactTextString(m) }
func (*GeoSite) ProtoMessage() {} func (*GeoSite) ProtoMessage() {}
func (*GeoSite) Descriptor() ([]byte, []int) { func (*GeoSite) Descriptor() ([]byte, []int) {
return fileDescriptor_config_bdac2d1c90ceb42f, []int{4} return fileDescriptor_config_38b171a67be39168, []int{4}
} }
func (m *GeoSite) XXX_Unmarshal(b []byte) error { func (m *GeoSite) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GeoSite.Unmarshal(m, b) return xxx_messageInfo_GeoSite.Unmarshal(m, b)
@ -318,7 +318,7 @@ func (m *GeoSiteList) Reset() { *m = GeoSiteList{} }
func (m *GeoSiteList) String() string { return proto.CompactTextString(m) } func (m *GeoSiteList) String() string { return proto.CompactTextString(m) }
func (*GeoSiteList) ProtoMessage() {} func (*GeoSiteList) ProtoMessage() {}
func (*GeoSiteList) Descriptor() ([]byte, []int) { func (*GeoSiteList) Descriptor() ([]byte, []int) {
return fileDescriptor_config_bdac2d1c90ceb42f, []int{5} return fileDescriptor_config_38b171a67be39168, []int{5}
} }
func (m *GeoSiteList) XXX_Unmarshal(b []byte) error { func (m *GeoSiteList) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GeoSiteList.Unmarshal(m, b) return xxx_messageInfo_GeoSiteList.Unmarshal(m, b)
@ -354,6 +354,7 @@ type RoutingRule struct {
SourceCidr []*CIDR `protobuf:"bytes,6,rep,name=source_cidr,json=sourceCidr,proto3" json:"source_cidr,omitempty"` SourceCidr []*CIDR `protobuf:"bytes,6,rep,name=source_cidr,json=sourceCidr,proto3" json:"source_cidr,omitempty"`
UserEmail []string `protobuf:"bytes,7,rep,name=user_email,json=userEmail,proto3" json:"user_email,omitempty"` UserEmail []string `protobuf:"bytes,7,rep,name=user_email,json=userEmail,proto3" json:"user_email,omitempty"`
InboundTag []string `protobuf:"bytes,8,rep,name=inbound_tag,json=inboundTag,proto3" json:"inbound_tag,omitempty"` InboundTag []string `protobuf:"bytes,8,rep,name=inbound_tag,json=inboundTag,proto3" json:"inbound_tag,omitempty"`
Protocol []string `protobuf:"bytes,9,rep,name=protocol,proto3" json:"protocol,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
@ -363,7 +364,7 @@ func (m *RoutingRule) Reset() { *m = RoutingRule{} }
func (m *RoutingRule) String() string { return proto.CompactTextString(m) } func (m *RoutingRule) String() string { return proto.CompactTextString(m) }
func (*RoutingRule) ProtoMessage() {} func (*RoutingRule) ProtoMessage() {}
func (*RoutingRule) Descriptor() ([]byte, []int) { func (*RoutingRule) Descriptor() ([]byte, []int) {
return fileDescriptor_config_bdac2d1c90ceb42f, []int{6} return fileDescriptor_config_38b171a67be39168, []int{6}
} }
func (m *RoutingRule) XXX_Unmarshal(b []byte) error { func (m *RoutingRule) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RoutingRule.Unmarshal(m, b) return xxx_messageInfo_RoutingRule.Unmarshal(m, b)
@ -439,6 +440,13 @@ func (m *RoutingRule) GetInboundTag() []string {
return nil return nil
} }
func (m *RoutingRule) GetProtocol() []string {
if m != nil {
return m.Protocol
}
return nil
}
type Config struct { type Config struct {
DomainStrategy Config_DomainStrategy `protobuf:"varint,1,opt,name=domain_strategy,json=domainStrategy,proto3,enum=v2ray.core.app.router.Config_DomainStrategy" json:"domain_strategy,omitempty"` DomainStrategy Config_DomainStrategy `protobuf:"varint,1,opt,name=domain_strategy,json=domainStrategy,proto3,enum=v2ray.core.app.router.Config_DomainStrategy" json:"domain_strategy,omitempty"`
Rule []*RoutingRule `protobuf:"bytes,2,rep,name=rule,proto3" json:"rule,omitempty"` Rule []*RoutingRule `protobuf:"bytes,2,rep,name=rule,proto3" json:"rule,omitempty"`
@ -451,7 +459,7 @@ func (m *Config) Reset() { *m = Config{} }
func (m *Config) String() string { return proto.CompactTextString(m) } func (m *Config) String() string { return proto.CompactTextString(m) }
func (*Config) ProtoMessage() {} func (*Config) ProtoMessage() {}
func (*Config) Descriptor() ([]byte, []int) { func (*Config) Descriptor() ([]byte, []int) {
return fileDescriptor_config_bdac2d1c90ceb42f, []int{7} return fileDescriptor_config_38b171a67be39168, []int{7}
} }
func (m *Config) XXX_Unmarshal(b []byte) error { func (m *Config) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Config.Unmarshal(m, b) return xxx_messageInfo_Config.Unmarshal(m, b)
@ -499,49 +507,50 @@ func init() {
} }
func init() { func init() {
proto.RegisterFile("v2ray.com/core/app/router/config.proto", fileDescriptor_config_bdac2d1c90ceb42f) proto.RegisterFile("v2ray.com/core/app/router/config.proto", fileDescriptor_config_38b171a67be39168)
} }
var fileDescriptor_config_bdac2d1c90ceb42f = []byte{ var fileDescriptor_config_38b171a67be39168 = []byte{
// 640 bytes of a gzipped FileDescriptorProto // 651 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x94, 0xcd, 0x6e, 0xd4, 0x3a, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x5d, 0x6f, 0xd3, 0x4a,
0x14, 0xc7, 0x6f, 0xe6, 0xab, 0x9d, 0x93, 0xb9, 0x73, 0x23, 0xeb, 0x16, 0x0d, 0x85, 0xc2, 0x10, 0x10, 0xbd, 0xce, 0x57, 0xeb, 0x71, 0x6e, 0xae, 0xb5, 0xba, 0xbd, 0xf2, 0x2d, 0x14, 0x82, 0x85,
0x21, 0x98, 0x05, 0x4a, 0xa4, 0xe1, 0x63, 0x05, 0xaa, 0xca, 0xb4, 0xaa, 0x22, 0x41, 0x19, 0xb9, 0x20, 0x0f, 0xc8, 0x91, 0xc2, 0xc7, 0x13, 0xa8, 0x2a, 0x69, 0x55, 0x45, 0x82, 0x12, 0x6d, 0x5b,
0x2d, 0x0b, 0x58, 0x44, 0x6e, 0xe2, 0x86, 0x88, 0x89, 0x6d, 0x39, 0x4e, 0xe9, 0xec, 0x78, 0x01, 0x1e, 0xe0, 0x21, 0xda, 0xda, 0x5b, 0x63, 0x61, 0xef, 0xae, 0xd6, 0xeb, 0xd2, 0xb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 0x44, 0xe5, 0x49, 0xcf, 0xbc, 0x2f, 0xae, 0x9f, 0x3b, 0x77, 0xde, 0xf5, 0x6c, 0xf4, 0xb5, 0xb5, 0xf1, 0x76, 0x82, 0xc9, 0x32,
0x59, 0x8f, 0xbf, 0x07, 0x00, 0x00, 0xff, 0xff, 0x53, 0x7c, 0xa8, 0x94, 0x43, 0x05, 0x00, 0x00, 0x9a, 0x6a, 0xc4, 0x8e, 0x10, 0x46, 0x12, 0x95, 0x27, 0x3d, 0xe3, 0xd5, 0xe3, 0xef, 0x01, 0x00,
0x00, 0xff, 0xff, 0xa5, 0x5f, 0xde, 0x29, 0x5f, 0x05, 0x00, 0x00,
} }

View File

@ -64,6 +64,7 @@ message RoutingRule {
repeated CIDR source_cidr = 6; repeated CIDR source_cidr = 6;
repeated string user_email = 7; repeated string user_email = 7;
repeated string inbound_tag = 8; repeated string inbound_tag = 8;
repeated string protocol = 9;
} }
message Config { message Config {

View File

@ -2,4 +2,6 @@ package mtproto
import "v2ray.com/core/common/errors" import "v2ray.com/core/common/errors"
func newError(values ...interface{}) *errors.Error { return errors.New(values...).Path("Proxy", "MTProto") } func newError(values ...interface{}) *errors.Error {
return errors.New(values...).Path("Proxy", "MTProto")
}