mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-04 17:27:23 -05:00
265 lines
10 KiB
Go
265 lines
10 KiB
Go
package socks
|
|
|
|
import (
|
|
fmt "fmt"
|
|
proto "github.com/golang/protobuf/proto"
|
|
math "math"
|
|
net "v2ray.com/core/common/net"
|
|
protocol "v2ray.com/core/common/protocol"
|
|
)
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the proto package it is being compiled against.
|
|
// A compilation error at this line likely means your copy of the
|
|
// proto package needs to be updated.
|
|
const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
|
|
|
|
// AuthType is the authentication type of Socks proxy.
|
|
type AuthType int32
|
|
|
|
const (
|
|
// NO_AUTH is for anounymous authentication.
|
|
AuthType_NO_AUTH AuthType = 0
|
|
// PASSWORD is for username/password authentication.
|
|
AuthType_PASSWORD AuthType = 1
|
|
)
|
|
|
|
var AuthType_name = map[int32]string{
|
|
0: "NO_AUTH",
|
|
1: "PASSWORD",
|
|
}
|
|
|
|
var AuthType_value = map[string]int32{
|
|
"NO_AUTH": 0,
|
|
"PASSWORD": 1,
|
|
}
|
|
|
|
func (x AuthType) String() string {
|
|
return proto.EnumName(AuthType_name, int32(x))
|
|
}
|
|
|
|
func (AuthType) EnumDescriptor() ([]byte, []int) {
|
|
return fileDescriptor_e86958e2cebd3303, []int{0}
|
|
}
|
|
|
|
// Account represents a Socks account.
|
|
type Account struct {
|
|
Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
|
|
Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *Account) Reset() { *m = Account{} }
|
|
func (m *Account) String() string { return proto.CompactTextString(m) }
|
|
func (*Account) ProtoMessage() {}
|
|
func (*Account) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_e86958e2cebd3303, []int{0}
|
|
}
|
|
|
|
func (m *Account) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_Account.Unmarshal(m, b)
|
|
}
|
|
func (m *Account) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_Account.Marshal(b, m, deterministic)
|
|
}
|
|
func (m *Account) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_Account.Merge(m, src)
|
|
}
|
|
func (m *Account) XXX_Size() int {
|
|
return xxx_messageInfo_Account.Size(m)
|
|
}
|
|
func (m *Account) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_Account.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_Account proto.InternalMessageInfo
|
|
|
|
func (m *Account) GetUsername() string {
|
|
if m != nil {
|
|
return m.Username
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *Account) GetPassword() string {
|
|
if m != nil {
|
|
return m.Password
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// ServerConfig is the protobuf config for Socks server.
|
|
type ServerConfig struct {
|
|
AuthType AuthType `protobuf:"varint,1,opt,name=auth_type,json=authType,proto3,enum=v2ray.core.proxy.socks.AuthType" json:"auth_type,omitempty"`
|
|
Accounts map[string]string `protobuf:"bytes,2,rep,name=accounts,proto3" json:"accounts,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
|
|
Address *net.IPOrDomain `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`
|
|
UdpEnabled bool `protobuf:"varint,4,opt,name=udp_enabled,json=udpEnabled,proto3" json:"udp_enabled,omitempty"`
|
|
Timeout uint32 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"` // Deprecated: Do not use.
|
|
UserLevel uint32 `protobuf:"varint,6,opt,name=user_level,json=userLevel,proto3" json:"user_level,omitempty"`
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *ServerConfig) Reset() { *m = ServerConfig{} }
|
|
func (m *ServerConfig) String() string { return proto.CompactTextString(m) }
|
|
func (*ServerConfig) ProtoMessage() {}
|
|
func (*ServerConfig) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_e86958e2cebd3303, []int{1}
|
|
}
|
|
|
|
func (m *ServerConfig) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_ServerConfig.Unmarshal(m, b)
|
|
}
|
|
func (m *ServerConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_ServerConfig.Marshal(b, m, deterministic)
|
|
}
|
|
func (m *ServerConfig) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_ServerConfig.Merge(m, src)
|
|
}
|
|
func (m *ServerConfig) XXX_Size() int {
|
|
return xxx_messageInfo_ServerConfig.Size(m)
|
|
}
|
|
func (m *ServerConfig) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_ServerConfig.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_ServerConfig proto.InternalMessageInfo
|
|
|
|
func (m *ServerConfig) GetAuthType() AuthType {
|
|
if m != nil {
|
|
return m.AuthType
|
|
}
|
|
return AuthType_NO_AUTH
|
|
}
|
|
|
|
func (m *ServerConfig) GetAccounts() map[string]string {
|
|
if m != nil {
|
|
return m.Accounts
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *ServerConfig) GetAddress() *net.IPOrDomain {
|
|
if m != nil {
|
|
return m.Address
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *ServerConfig) GetUdpEnabled() bool {
|
|
if m != nil {
|
|
return m.UdpEnabled
|
|
}
|
|
return false
|
|
}
|
|
|
|
// Deprecated: Do not use.
|
|
func (m *ServerConfig) GetTimeout() uint32 {
|
|
if m != nil {
|
|
return m.Timeout
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *ServerConfig) GetUserLevel() uint32 {
|
|
if m != nil {
|
|
return m.UserLevel
|
|
}
|
|
return 0
|
|
}
|
|
|
|
// ClientConfig is the protobuf config for Socks client.
|
|
type ClientConfig struct {
|
|
// Sever is a list of Socks server addresses.
|
|
Server []*protocol.ServerEndpoint `protobuf:"bytes,1,rep,name=server,proto3" json:"server,omitempty"`
|
|
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
XXX_sizecache int32 `json:"-"`
|
|
}
|
|
|
|
func (m *ClientConfig) Reset() { *m = ClientConfig{} }
|
|
func (m *ClientConfig) String() string { return proto.CompactTextString(m) }
|
|
func (*ClientConfig) ProtoMessage() {}
|
|
func (*ClientConfig) Descriptor() ([]byte, []int) {
|
|
return fileDescriptor_e86958e2cebd3303, []int{2}
|
|
}
|
|
|
|
func (m *ClientConfig) XXX_Unmarshal(b []byte) error {
|
|
return xxx_messageInfo_ClientConfig.Unmarshal(m, b)
|
|
}
|
|
func (m *ClientConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
|
return xxx_messageInfo_ClientConfig.Marshal(b, m, deterministic)
|
|
}
|
|
func (m *ClientConfig) XXX_Merge(src proto.Message) {
|
|
xxx_messageInfo_ClientConfig.Merge(m, src)
|
|
}
|
|
func (m *ClientConfig) XXX_Size() int {
|
|
return xxx_messageInfo_ClientConfig.Size(m)
|
|
}
|
|
func (m *ClientConfig) XXX_DiscardUnknown() {
|
|
xxx_messageInfo_ClientConfig.DiscardUnknown(m)
|
|
}
|
|
|
|
var xxx_messageInfo_ClientConfig proto.InternalMessageInfo
|
|
|
|
func (m *ClientConfig) GetServer() []*protocol.ServerEndpoint {
|
|
if m != nil {
|
|
return m.Server
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func init() {
|
|
proto.RegisterEnum("v2ray.core.proxy.socks.AuthType", AuthType_name, AuthType_value)
|
|
proto.RegisterType((*Account)(nil), "v2ray.core.proxy.socks.Account")
|
|
proto.RegisterType((*ServerConfig)(nil), "v2ray.core.proxy.socks.ServerConfig")
|
|
proto.RegisterMapType((map[string]string)(nil), "v2ray.core.proxy.socks.ServerConfig.AccountsEntry")
|
|
proto.RegisterType((*ClientConfig)(nil), "v2ray.core.proxy.socks.ClientConfig")
|
|
}
|
|
|
|
func init() {
|
|
proto.RegisterFile("v2ray.com/core/proxy/socks/config.proto", fileDescriptor_e86958e2cebd3303)
|
|
}
|
|
|
|
var fileDescriptor_e86958e2cebd3303 = []byte{
|
|
// 470 bytes of a gzipped FileDescriptorProto
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x52, 0x5d, 0x8b, 0xd3, 0x40,
|
|
0x14, 0x75, 0xb2, 0xb6, 0x4d, 0x6f, 0xbb, 0x52, 0x06, 0x59, 0x42, 0x51, 0x8c, 0x05, 0xb1, 0xec,
|
|
0xc3, 0x44, 0xe2, 0x8b, 0xb8, 0x28, 0xb4, 0xdd, 0x82, 0x82, 0x6c, 0xcb, 0x74, 0x55, 0xf0, 0x25,
|
|
0xcc, 0x4e, 0x46, 0x37, 0x6c, 0x32, 0x13, 0x66, 0x26, 0xd5, 0xfc, 0x25, 0xff, 0x9f, 0xef, 0x92,
|
|
0xaf, 0x65, 0x95, 0xee, 0xdb, 0xfd, 0x38, 0xf7, 0xcc, 0x3d, 0xe7, 0x0e, 0xbc, 0xdc, 0x87, 0x9a,
|
|
0x95, 0x84, 0xab, 0x2c, 0xe0, 0x4a, 0x8b, 0x20, 0xd7, 0xea, 0x57, 0x19, 0x18, 0xc5, 0x6f, 0x4c,
|
|
0xc0, 0x95, 0xfc, 0x9e, 0xfc, 0x20, 0xb9, 0x56, 0x56, 0xe1, 0x93, 0x0e, 0xa8, 0x05, 0xa9, 0x41,
|
|
0xa4, 0x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