1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-02 23:47:07 -05:00

options for TProxy

This commit is contained in:
Darien Raymond 2018-09-14 11:05:42 +02:00
parent d068f357bd
commit eeca745e89
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
3 changed files with 88 additions and 59 deletions

View File

@ -35,6 +35,7 @@ var TransportProtocol_name = map[int32]string{
4: "HTTP", 4: "HTTP",
5: "DomainSocket", 5: "DomainSocket",
} }
var TransportProtocol_value = map[string]int32{ var TransportProtocol_value = map[string]int32{
"TCP": 0, "TCP": 0,
"UDP": 1, "UDP": 1,
@ -47,8 +48,9 @@ var TransportProtocol_value = map[string]int32{
func (x TransportProtocol) String() string { func (x TransportProtocol) String() string {
return proto.EnumName(TransportProtocol_name, int32(x)) return proto.EnumName(TransportProtocol_name, int32(x))
} }
func (TransportProtocol) EnumDescriptor() ([]byte, []int) { func (TransportProtocol) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_config_d7068fe3707ce485, []int{0} return fileDescriptor_91dbc815c3d97a05, []int{0}
} }
type SocketConfig_TCPFastOpenState int32 type SocketConfig_TCPFastOpenState int32
@ -67,6 +69,7 @@ var SocketConfig_TCPFastOpenState_name = map[int32]string{
1: "Enable", 1: "Enable",
2: "Disable", 2: "Disable",
} }
var SocketConfig_TCPFastOpenState_value = map[string]int32{ var SocketConfig_TCPFastOpenState_value = map[string]int32{
"AsIs": 0, "AsIs": 0,
"Enable": 1, "Enable": 1,
@ -76,8 +79,9 @@ var SocketConfig_TCPFastOpenState_value = map[string]int32{
func (x SocketConfig_TCPFastOpenState) String() string { func (x SocketConfig_TCPFastOpenState) String() string {
return proto.EnumName(SocketConfig_TCPFastOpenState_name, int32(x)) return proto.EnumName(SocketConfig_TCPFastOpenState_name, int32(x))
} }
func (SocketConfig_TCPFastOpenState) EnumDescriptor() ([]byte, []int) { func (SocketConfig_TCPFastOpenState) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_config_d7068fe3707ce485, []int{3, 0} return fileDescriptor_91dbc815c3d97a05, []int{3, 0}
} }
type TransportConfig struct { type TransportConfig struct {
@ -97,7 +101,7 @@ func (m *TransportConfig) Reset() { *m = TransportConfig{} }
func (m *TransportConfig) String() string { return proto.CompactTextString(m) } func (m *TransportConfig) String() string { return proto.CompactTextString(m) }
func (*TransportConfig) ProtoMessage() {} func (*TransportConfig) ProtoMessage() {}
func (*TransportConfig) Descriptor() ([]byte, []int) { func (*TransportConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_config_d7068fe3707ce485, []int{0} return fileDescriptor_91dbc815c3d97a05, []int{0}
} }
func (m *TransportConfig) XXX_Unmarshal(b []byte) error { func (m *TransportConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_TransportConfig.Unmarshal(m, b) return xxx_messageInfo_TransportConfig.Unmarshal(m, b)
@ -105,8 +109,8 @@ func (m *TransportConfig) XXX_Unmarshal(b []byte) error {
func (m *TransportConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *TransportConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_TransportConfig.Marshal(b, m, deterministic) return xxx_messageInfo_TransportConfig.Marshal(b, m, deterministic)
} }
func (dst *TransportConfig) XXX_Merge(src proto.Message) { func (m *TransportConfig) XXX_Merge(src proto.Message) {
xxx_messageInfo_TransportConfig.Merge(dst, src) xxx_messageInfo_TransportConfig.Merge(m, src)
} }
func (m *TransportConfig) XXX_Size() int { func (m *TransportConfig) XXX_Size() int {
return xxx_messageInfo_TransportConfig.Size(m) return xxx_messageInfo_TransportConfig.Size(m)
@ -158,7 +162,7 @@ func (m *StreamConfig) Reset() { *m = StreamConfig{} }
func (m *StreamConfig) String() string { return proto.CompactTextString(m) } func (m *StreamConfig) String() string { return proto.CompactTextString(m) }
func (*StreamConfig) ProtoMessage() {} func (*StreamConfig) ProtoMessage() {}
func (*StreamConfig) Descriptor() ([]byte, []int) { func (*StreamConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_config_d7068fe3707ce485, []int{1} return fileDescriptor_91dbc815c3d97a05, []int{1}
} }
func (m *StreamConfig) XXX_Unmarshal(b []byte) error { func (m *StreamConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StreamConfig.Unmarshal(m, b) return xxx_messageInfo_StreamConfig.Unmarshal(m, b)
@ -166,8 +170,8 @@ func (m *StreamConfig) XXX_Unmarshal(b []byte) error {
func (m *StreamConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *StreamConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_StreamConfig.Marshal(b, m, deterministic) return xxx_messageInfo_StreamConfig.Marshal(b, m, deterministic)
} }
func (dst *StreamConfig) XXX_Merge(src proto.Message) { func (m *StreamConfig) XXX_Merge(src proto.Message) {
xxx_messageInfo_StreamConfig.Merge(dst, src) xxx_messageInfo_StreamConfig.Merge(m, src)
} }
func (m *StreamConfig) XXX_Size() int { func (m *StreamConfig) XXX_Size() int {
return xxx_messageInfo_StreamConfig.Size(m) return xxx_messageInfo_StreamConfig.Size(m)
@ -232,7 +236,7 @@ func (m *ProxyConfig) Reset() { *m = ProxyConfig{} }
func (m *ProxyConfig) String() string { return proto.CompactTextString(m) } func (m *ProxyConfig) String() string { return proto.CompactTextString(m) }
func (*ProxyConfig) ProtoMessage() {} func (*ProxyConfig) ProtoMessage() {}
func (*ProxyConfig) Descriptor() ([]byte, []int) { func (*ProxyConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_config_d7068fe3707ce485, []int{2} return fileDescriptor_91dbc815c3d97a05, []int{2}
} }
func (m *ProxyConfig) XXX_Unmarshal(b []byte) error { func (m *ProxyConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ProxyConfig.Unmarshal(m, b) return xxx_messageInfo_ProxyConfig.Unmarshal(m, b)
@ -240,8 +244,8 @@ func (m *ProxyConfig) XXX_Unmarshal(b []byte) error {
func (m *ProxyConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *ProxyConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_ProxyConfig.Marshal(b, m, deterministic) return xxx_messageInfo_ProxyConfig.Marshal(b, m, deterministic)
} }
func (dst *ProxyConfig) XXX_Merge(src proto.Message) { func (m *ProxyConfig) XXX_Merge(src proto.Message) {
xxx_messageInfo_ProxyConfig.Merge(dst, src) xxx_messageInfo_ProxyConfig.Merge(m, src)
} }
func (m *ProxyConfig) XXX_Size() int { func (m *ProxyConfig) XXX_Size() int {
return xxx_messageInfo_ProxyConfig.Size(m) return xxx_messageInfo_ProxyConfig.Size(m)
@ -264,17 +268,19 @@ type SocketConfig struct {
// Mark of the connection. If non-zero, the value will be set to SO_MARK. // Mark of the connection. If non-zero, the value will be set to SO_MARK.
Mark int32 `protobuf:"varint,1,opt,name=mark,proto3" json:"mark,omitempty"` Mark int32 `protobuf:"varint,1,opt,name=mark,proto3" json:"mark,omitempty"`
// TFO is the state of TFO settings. // TFO is the state of TFO settings.
Tfo SocketConfig_TCPFastOpenState `protobuf:"varint,2,opt,name=tfo,proto3,enum=v2ray.core.transport.internet.SocketConfig_TCPFastOpenState" json:"tfo,omitempty"` Tfo SocketConfig_TCPFastOpenState `protobuf:"varint,2,opt,name=tfo,proto3,enum=v2ray.core.transport.internet.SocketConfig_TCPFastOpenState" json:"tfo,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` // TProxy is for enabling TProxy socket option.
XXX_unrecognized []byte `json:"-"` Tproxy bool `protobuf:"varint,3,opt,name=tproxy,proto3" json:"tproxy,omitempty"`
XXX_sizecache int32 `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
} }
func (m *SocketConfig) Reset() { *m = SocketConfig{} } func (m *SocketConfig) Reset() { *m = SocketConfig{} }
func (m *SocketConfig) String() string { return proto.CompactTextString(m) } func (m *SocketConfig) String() string { return proto.CompactTextString(m) }
func (*SocketConfig) ProtoMessage() {} func (*SocketConfig) ProtoMessage() {}
func (*SocketConfig) Descriptor() ([]byte, []int) { func (*SocketConfig) Descriptor() ([]byte, []int) {
return fileDescriptor_config_d7068fe3707ce485, []int{3} return fileDescriptor_91dbc815c3d97a05, []int{3}
} }
func (m *SocketConfig) XXX_Unmarshal(b []byte) error { func (m *SocketConfig) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SocketConfig.Unmarshal(m, b) return xxx_messageInfo_SocketConfig.Unmarshal(m, b)
@ -282,8 +288,8 @@ func (m *SocketConfig) XXX_Unmarshal(b []byte) error {
func (m *SocketConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { func (m *SocketConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_SocketConfig.Marshal(b, m, deterministic) return xxx_messageInfo_SocketConfig.Marshal(b, m, deterministic)
} }
func (dst *SocketConfig) XXX_Merge(src proto.Message) { func (m *SocketConfig) XXX_Merge(src proto.Message) {
xxx_messageInfo_SocketConfig.Merge(dst, src) xxx_messageInfo_SocketConfig.Merge(m, src)
} }
func (m *SocketConfig) XXX_Size() int { func (m *SocketConfig) XXX_Size() int {
return xxx_messageInfo_SocketConfig.Size(m) return xxx_messageInfo_SocketConfig.Size(m)
@ -308,6 +314,13 @@ func (m *SocketConfig) GetTfo() SocketConfig_TCPFastOpenState {
return SocketConfig_AsIs return SocketConfig_AsIs
} }
func (m *SocketConfig) GetTproxy() bool {
if m != nil {
return m.Tproxy
}
return false
}
func init() { func init() {
proto.RegisterType((*TransportConfig)(nil), "v2ray.core.transport.internet.TransportConfig") proto.RegisterType((*TransportConfig)(nil), "v2ray.core.transport.internet.TransportConfig")
proto.RegisterType((*StreamConfig)(nil), "v2ray.core.transport.internet.StreamConfig") proto.RegisterType((*StreamConfig)(nil), "v2ray.core.transport.internet.StreamConfig")
@ -318,42 +331,43 @@ func init() {
} }
func init() { func init() {
proto.RegisterFile("v2ray.com/core/transport/internet/config.proto", fileDescriptor_config_d7068fe3707ce485) proto.RegisterFile("v2ray.com/core/transport/internet/config.proto", fileDescriptor_91dbc815c3d97a05)
} }
var fileDescriptor_config_d7068fe3707ce485 = []byte{ var fileDescriptor_91dbc815c3d97a05 = []byte{
// 518 bytes of a gzipped FileDescriptorProto // 533 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0xd1, 0x8a, 0x13, 0x31, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0xd1, 0x6b, 0x13, 0x4f,
0x14, 0x86, 0x77, 0x3a, 0x6d, 0xb7, 0x3d, 0xed, 0x76, 0xd3, 0x5c, 0x15, 0x61, 0xb1, 0x56, 0x90, 0x10, 0xc7, 0x7b, 0xb9, 0x24, 0x4d, 0x26, 0x69, 0xba, 0xd9, 0x87, 0x1f, 0xe1, 0x07, 0xc5, 0x18,
0xa2, 0x90, 0x59, 0x46, 0xbc, 0xf3, 0xc6, 0xb6, 0x8a, 0x8b, 0xee, 0xee, 0x30, 0x1d, 0x15, 0x16, 0x41, 0x82, 0xc2, 0x5e, 0x39, 0xf1, 0xcd, 0x17, 0x93, 0x28, 0x16, 0x6d, 0x7b, 0x5c, 0x4e, 0x85,
0xa4, 0xa4, 0x63, 0xb6, 0x0c, 0xdb, 0x99, 0x94, 0x24, 0x8a, 0x7d, 0x24, 0xbd, 0xf6, 0x21, 0x7c, 0x82, 0x84, 0xcd, 0xb9, 0x0d, 0x47, 0x73, 0xb7, 0x61, 0x77, 0x15, 0xf3, 0x2f, 0xf9, 0xec, 0x3f,
0x2c, 0x49, 0x66, 0x12, 0xca, 0x2a, 0x75, 0xc5, 0xbb, 0x33, 0x73, 0xfe, 0xfc, 0xe7, 0xff, 0x72, 0xe0, 0x9b, 0x7f, 0x96, 0xec, 0xde, 0xed, 0x12, 0xaa, 0xc4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, 0x43, 0xf0, 0x93, 0x69, 0x84,
0x68, 0x7f, 0x60, 0xcb, 0x32, 0x10, 0xf2, 0x75, 0xe3, 0x75, 0x92, 0x44, 0xa8, 0x8e, 0x11, 0x74, 0x0e, 0x74, 0xf0, 0x76, 0x16, 0x21, 0x4f, 0x2b, 0x9d, 0xbf, 0x9e, 0x46, 0xa8, 0x86, 0x8f, 0xa0,
0x67, 0x3c, 0xa7, 0x59, 0x51, 0xf5, 0x1a, 0x93, 0x4b, 0x78, 0x90, 0xf2, 0x7c, 0x3f, 0x5a, 0xe4, 0xfd, 0x9e, 0x2d, 0x4b, 0xa3, 0xc8, 0xd7, 0x89, 0x57, 0x49, 0x12, 0xa1, 0x3a, 0x46, 0xd0, 0x9d,
0x5d, 0xb5, 0x6c, 0xfd, 0xbd, 0x76, 0xf2, 0x3e, 0x8c, 0xe9, 0x96, 0x4c, 0xb5, 0xd6, 0xc5, 0x22, 0xf1, 0x9c, 0x66, 0x45, 0x95, 0x6b, 0x4c, 0x2e, 0xe1, 0x7e, 0xca, 0xf3, 0xfd, 0xc8, 0x91, 0x77,
0x67, 0x55, 0x7f, 0xd9, 0x34, 0xcf, 0xf6, 0xe9, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf3, 0x8d, 0xd5, 0xb2, 0xf1, 0xd7, 0xda, 0xc9, 0xbb, 0x30, 0xa6, 0x5b, 0x32, 0xd5, 0xb5, 0xce, 0x16, 0x39,
0xe5, 0xd8, 0x85, 0x04, 0x00, 0x00, 0xab, 0xf2, 0xcb, 0xa6, 0x79, 0xce, 0x4f, 0x7e, 0x06, 0x00, 0x00, 0xff, 0xff, 0xb9, 0x1d, 0xbb,
0xfd, 0x9d, 0x04, 0x00, 0x00,
} }

View File

@ -67,4 +67,7 @@ message SocketConfig {
// TFO is the state of TFO settings. // TFO is the state of TFO settings.
TCPFastOpenState tfo = 2; TCPFastOpenState tfo = 2;
// TProxy is for enabling TProxy socket option.
bool tproxy = 3;
} }

View File

@ -14,7 +14,7 @@ const (
func applyOutboundSocketOptions(network string, address string, fd uintptr, config *SocketConfig) error { func applyOutboundSocketOptions(network string, address string, fd uintptr, config *SocketConfig) error {
if config.Mark != 0 { if config.Mark != 0 {
if err := syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_MARK, int(config.Mark)); err != nil { if err := syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_MARK, int(config.Mark)); err != nil {
return err return newError("failed to set SO_MARK").Base(err)
} }
} }
@ -22,15 +22,21 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
switch config.Tfo { switch config.Tfo {
case SocketConfig_Enable: case SocketConfig_Enable:
if err := syscall.SetsockoptInt(int(fd), syscall.SOL_TCP, TCP_FASTOPEN_CONNECT, 1); err != nil { if err := syscall.SetsockoptInt(int(fd), syscall.SOL_TCP, TCP_FASTOPEN_CONNECT, 1); err != nil {
return err return newError("failed to set TCP_FASTOPEN_CONNECT=1").Base(err)
} }
case SocketConfig_Disable: case SocketConfig_Disable:
if err := syscall.SetsockoptInt(int(fd), syscall.SOL_TCP, TCP_FASTOPEN_CONNECT, 0); err != nil { if err := syscall.SetsockoptInt(int(fd), syscall.SOL_TCP, TCP_FASTOPEN_CONNECT, 0); err != nil {
return err return newError("failed to set TCP_FASTOPEN_CONNECT=0").Base(err)
} }
} }
} }
if config.Tproxy {
if err := syscall.SetsockoptInt(int(fd), syscall.SOL_IP, syscall.IP_TRANSPARENT, 1); err != nil {
return newError("failed to set IP_TRANSPARENT").Base(err)
}
}
return nil return nil
} }
@ -39,14 +45,20 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
switch config.Tfo { switch config.Tfo {
case SocketConfig_Enable: case SocketConfig_Enable:
if err := syscall.SetsockoptInt(int(fd), syscall.SOL_TCP, TCP_FASTOPEN, 1); err != nil { if err := syscall.SetsockoptInt(int(fd), syscall.SOL_TCP, TCP_FASTOPEN, 1); err != nil {
return err return newError("failed to set TCP_FASTOPEN=1").Base(err)
} }
case SocketConfig_Disable: case SocketConfig_Disable:
if err := syscall.SetsockoptInt(int(fd), syscall.SOL_TCP, TCP_FASTOPEN, 0); err != nil { if err := syscall.SetsockoptInt(int(fd), syscall.SOL_TCP, TCP_FASTOPEN, 0); err != nil {
return err return newError("failed to set TCP_FASTOPEN=0").Base(err)
} }
} }
} }
if config.Tproxy {
if err := syscall.SetsockoptInt(int(fd), syscall.SOL_IP, syscall.IP_TRANSPARENT, 1); err != nil {
return newError("failed to set IP_TRANSPARENT").Base(err)
}
}
return nil return nil
} }