diff --git a/proxy/vmess/config/inbound.go b/proxy/vmess/config/inbound.go deleted file mode 100644 index 3de370462..000000000 --- a/proxy/vmess/config/inbound.go +++ /dev/null @@ -1,5 +0,0 @@ -package config - -type Inbound interface { - AllowedUsers() []User -} diff --git a/proxy/vmess/config/outbound.go b/proxy/vmess/config/outbound.go deleted file mode 100644 index 6085a3ae6..000000000 --- a/proxy/vmess/config/outbound.go +++ /dev/null @@ -1,14 +0,0 @@ -package config - -import ( - v2net "github.com/v2ray/v2ray-core/common/net" -) - -type Receiver struct { - Address v2net.Address - Accounts []User -} - -type Outbound interface { - Receivers() []*Receiver -} diff --git a/proxy/vmess/config/id.go b/proxy/vmess/id.go similarity index 98% rename from proxy/vmess/config/id.go rename to proxy/vmess/id.go index 6f891310f..63e48b23f 100644 --- a/proxy/vmess/config/id.go +++ b/proxy/vmess/id.go @@ -1,4 +1,4 @@ -package config +package vmess import ( "crypto/md5" diff --git a/proxy/vmess/config/id_test.go b/proxy/vmess/id_test.go similarity index 96% rename from proxy/vmess/config/id_test.go rename to proxy/vmess/id_test.go index 568e9df72..d44e84f78 100644 --- a/proxy/vmess/config/id_test.go +++ b/proxy/vmess/id_test.go @@ -1,4 +1,4 @@ -package config +package vmess import ( "testing" diff --git a/proxy/vmess/inbound/config.go b/proxy/vmess/inbound/config.go new file mode 100644 index 000000000..415ad92ae --- /dev/null +++ b/proxy/vmess/inbound/config.go @@ -0,0 +1,9 @@ +package inbound + +import ( + "github.com/v2ray/v2ray-core/proxy/vmess" +) + +type Config interface { + AllowedUsers() []vmess.User +} diff --git a/proxy/vmess/inbound/inbound.go b/proxy/vmess/inbound/inbound.go index b470b4c50..3de7274a2 100644 --- a/proxy/vmess/inbound/inbound.go +++ b/proxy/vmess/inbound/inbound.go @@ -13,7 +13,7 @@ import ( v2net "github.com/v2ray/v2ray-core/common/net" "github.com/v2ray/v2ray-core/common/retry" "github.com/v2ray/v2ray-core/proxy/common/connhandler" - "github.com/v2ray/v2ray-core/proxy/vmess/config" + "github.com/v2ray/v2ray-core/proxy/vmess" "github.com/v2ray/v2ray-core/proxy/vmess/protocol" "github.com/v2ray/v2ray-core/proxy/vmess/protocol/user" ) @@ -85,7 +85,7 @@ func (this *VMessInboundHandler) HandleConnection(connection *net.TCPConn) error readFinish.Lock() writeFinish.Lock() - userSettings := config.GetUserSettings(request.User.Level()) + userSettings := vmess.GetUserSettings(request.User.Level()) connReader.SetTimeOut(userSettings.PayloadReadTimeout) go handleInput(request, connReader, input, &readFinish) @@ -143,7 +143,7 @@ type VMessInboundHandlerFactory struct { } func (this *VMessInboundHandlerFactory) Create(space *app.Space, rawConfig interface{}) (connhandler.InboundConnectionHandler, error) { - config := rawConfig.(config.Inbound) + config := rawConfig.(Config) allowedClients := user.NewTimedUserSet() for _, user := range config.AllowedUsers() { diff --git a/proxy/vmess/config/json/inbound.go b/proxy/vmess/inbound/json/inbound.go similarity index 54% rename from proxy/vmess/config/json/inbound.go rename to proxy/vmess/inbound/json/inbound.go index 286fa39ce..2e5decc35 100644 --- a/proxy/vmess/config/json/inbound.go +++ b/proxy/vmess/inbound/json/inbound.go @@ -2,15 +2,16 @@ package json import ( "github.com/v2ray/v2ray-core/proxy/common/config/json" - vmessconfig "github.com/v2ray/v2ray-core/proxy/vmess/config" + "github.com/v2ray/v2ray-core/proxy/vmess" + vmessjson "github.com/v2ray/v2ray-core/proxy/vmess/json" ) type Inbound struct { - AllowedClients []*ConfigUser `json:"clients"` + AllowedClients []*vmessjson.ConfigUser `json:"clients"` } -func (c *Inbound) AllowedUsers() []vmessconfig.User { - users := make([]vmessconfig.User, 0, len(c.AllowedClients)) +func (c *Inbound) AllowedUsers() []vmess.User { + users := make([]vmess.User, 0, len(c.AllowedClients)) for _, rawUser := range c.AllowedClients { users = append(users, rawUser) } diff --git a/proxy/vmess/config/json/user.go b/proxy/vmess/json/user.go similarity index 66% rename from proxy/vmess/config/json/user.go rename to proxy/vmess/json/user.go index d48454521..3a9639c85 100644 --- a/proxy/vmess/config/json/user.go +++ b/proxy/vmess/json/user.go @@ -3,14 +3,14 @@ package json import ( "encoding/json" - "github.com/v2ray/v2ray-core/proxy/vmess/config" + "github.com/v2ray/v2ray-core/proxy/vmess" ) // ConfigUser is an user account in VMess configuration. type ConfigUser struct { - Id *config.ID + Id *vmess.ID Email string - LevelValue config.UserLevel + LevelValue vmess.UserLevel } func (u *ConfigUser) UnmarshalJSON(data []byte) error { @@ -23,20 +23,20 @@ func (u *ConfigUser) UnmarshalJSON(data []byte) error { if err := json.Unmarshal(data, &rawUserValue); err != nil { return err } - id, err := config.NewID(rawUserValue.IdString) + id, err := vmess.NewID(rawUserValue.IdString) if err != nil { return err } u.Id = id u.Email = rawUserValue.EmailString - u.LevelValue = config.UserLevel(rawUserValue.LevelInt) + u.LevelValue = vmess.UserLevel(rawUserValue.LevelInt) return nil } -func (u *ConfigUser) ID() *config.ID { +func (u *ConfigUser) ID() *vmess.ID { return u.Id } -func (this *ConfigUser) Level() config.UserLevel { +func (this *ConfigUser) Level() vmess.UserLevel { return this.LevelValue } diff --git a/proxy/vmess/outbound/config.go b/proxy/vmess/outbound/config.go new file mode 100644 index 000000000..f1dc245cd --- /dev/null +++ b/proxy/vmess/outbound/config.go @@ -0,0 +1,5 @@ +package outbound + +type Config interface { + Receivers() []*Receiver +} diff --git a/proxy/vmess/config/json/outbound.go b/proxy/vmess/outbound/json/outbound.go similarity index 75% rename from proxy/vmess/config/json/outbound.go rename to proxy/vmess/outbound/json/outbound.go index 6feae0119..47d8e63ac 100644 --- a/proxy/vmess/config/json/outbound.go +++ b/proxy/vmess/outbound/json/outbound.go @@ -8,19 +8,21 @@ import ( v2net "github.com/v2ray/v2ray-core/common/net" proxyconfig "github.com/v2ray/v2ray-core/proxy/common/config" jsonconfig "github.com/v2ray/v2ray-core/proxy/common/config/json" - vmessconfig "github.com/v2ray/v2ray-core/proxy/vmess/config" + "github.com/v2ray/v2ray-core/proxy/vmess" + vmessjson "github.com/v2ray/v2ray-core/proxy/vmess/json" + "github.com/v2ray/v2ray-core/proxy/vmess/outbound" ) type ConfigTarget struct { Address v2net.Address - Users []*ConfigUser + Users []*vmessjson.ConfigUser } func (t *ConfigTarget) UnmarshalJSON(data []byte) error { type RawConfigTarget struct { - Address string `json:"address"` - Port v2net.Port `json:"port"` - Users []*ConfigUser `json:"users"` + Address string `json:"address"` + Port v2net.Port `json:"port"` + Users []*vmessjson.ConfigUser `json:"users"` } var rawConfig RawConfigTarget if err := json.Unmarshal(data, &rawConfig); err != nil { @@ -61,14 +63,14 @@ func (this *Outbound) UnmarshalJSON(data []byte) error { return nil } -func (o *Outbound) Receivers() []*vmessconfig.Receiver { - targets := make([]*vmessconfig.Receiver, 0, 2*len(o.TargetList)) +func (o *Outbound) Receivers() []*outbound.Receiver { + targets := make([]*outbound.Receiver, 0, 2*len(o.TargetList)) for _, rawTarget := range o.TargetList { - users := make([]vmessconfig.User, 0, len(rawTarget.Users)) + users := make([]vmess.User, 0, len(rawTarget.Users)) for _, rawUser := range rawTarget.Users { users = append(users, rawUser) } - targets = append(targets, &vmessconfig.Receiver{ + targets = append(targets, &outbound.Receiver{ Address: rawTarget.Address, Accounts: users, }) diff --git a/proxy/vmess/config/json/outbound_test.go b/proxy/vmess/outbound/json/outbound_test.go similarity index 91% rename from proxy/vmess/config/json/outbound_test.go rename to proxy/vmess/outbound/json/outbound_test.go index b35a4adb4..c72c2444a 100644 --- a/proxy/vmess/config/json/outbound_test.go +++ b/proxy/vmess/outbound/json/outbound_test.go @@ -4,7 +4,7 @@ import ( "encoding/json" "testing" - jsonconfig "github.com/v2ray/v2ray-core/proxy/vmess/config/json" + jsonconfig "github.com/v2ray/v2ray-core/proxy/vmess/outbound/json" v2testing "github.com/v2ray/v2ray-core/testing" "github.com/v2ray/v2ray-core/testing/assert" ) diff --git a/proxy/vmess/outbound/outbound.go b/proxy/vmess/outbound/outbound.go index 0896ac905..0826c92f1 100644 --- a/proxy/vmess/outbound/outbound.go +++ b/proxy/vmess/outbound/outbound.go @@ -12,7 +12,6 @@ import ( "github.com/v2ray/v2ray-core/common/log" v2net "github.com/v2ray/v2ray-core/common/net" "github.com/v2ray/v2ray-core/proxy/common/connhandler" - "github.com/v2ray/v2ray-core/proxy/vmess/config" "github.com/v2ray/v2ray-core/proxy/vmess/protocol" "github.com/v2ray/v2ray-core/proxy/vmess/protocol/user" "github.com/v2ray/v2ray-core/transport/ray" @@ -177,7 +176,7 @@ type VMessOutboundHandlerFactory struct { } func (this *VMessOutboundHandlerFactory) Create(space *app.Space, rawConfig interface{}) (connhandler.OutboundConnectionHandler, error) { - vOutConfig := rawConfig.(config.Outbound) + vOutConfig := rawConfig.(Config) return &VMessOutboundHandler{ space: space, receiverManager: NewReceiverManager(vOutConfig.Receivers()), diff --git a/proxy/vmess/outbound/receiver_manager.go b/proxy/vmess/outbound/receiver.go similarity index 64% rename from proxy/vmess/outbound/receiver_manager.go rename to proxy/vmess/outbound/receiver.go index c3eff03f1..6703a805a 100644 --- a/proxy/vmess/outbound/receiver_manager.go +++ b/proxy/vmess/outbound/receiver.go @@ -4,20 +4,25 @@ import ( "math/rand" v2net "github.com/v2ray/v2ray-core/common/net" - "github.com/v2ray/v2ray-core/proxy/vmess/config" + "github.com/v2ray/v2ray-core/proxy/vmess" ) -type ReceiverManager struct { - receivers []*config.Receiver +type Receiver struct { + Address v2net.Address + Accounts []vmess.User } -func NewReceiverManager(receivers []*config.Receiver) *ReceiverManager { +type ReceiverManager struct { + receivers []*Receiver +} + +func NewReceiverManager(receivers []*Receiver) *ReceiverManager { return &ReceiverManager{ receivers: receivers, } } -func (this *ReceiverManager) PickReceiver() (v2net.Address, config.User) { +func (this *ReceiverManager) PickReceiver() (v2net.Address, vmess.User) { receiverLen := len(this.receivers) receiverIdx := 0 if receiverLen > 1 { diff --git a/proxy/vmess/protocol/user/testing/mocks/mockuserset.go b/proxy/vmess/protocol/user/testing/mocks/mockuserset.go index d36e6d303..9962d28e1 100644 --- a/proxy/vmess/protocol/user/testing/mocks/mockuserset.go +++ b/proxy/vmess/protocol/user/testing/mocks/mockuserset.go @@ -1,21 +1,21 @@ package mocks import ( - "github.com/v2ray/v2ray-core/proxy/vmess/config" + "github.com/v2ray/v2ray-core/proxy/vmess" ) type MockUserSet struct { - Users []config.User + Users []vmess.User UserHashes map[string]int Timestamps map[string]int64 } -func (us *MockUserSet) AddUser(user config.User) error { +func (us *MockUserSet) AddUser(user vmess.User) error { us.Users = append(us.Users, user) return nil } -func (us *MockUserSet) GetUser(userhash []byte) (config.User, int64, bool) { +func (us *MockUserSet) GetUser(userhash []byte) (vmess.User, int64, bool) { idx, found := us.UserHashes[string(userhash)] if found { return us.Users[idx], us.Timestamps[string(userhash)], true diff --git a/proxy/vmess/protocol/user/testing/mocks/static_userset.go b/proxy/vmess/protocol/user/testing/mocks/static_userset.go index faa9a6487..075a4e66a 100644 --- a/proxy/vmess/protocol/user/testing/mocks/static_userset.go +++ b/proxy/vmess/protocol/user/testing/mocks/static_userset.go @@ -1,29 +1,29 @@ package mocks import ( - "github.com/v2ray/v2ray-core/proxy/vmess/config" + "github.com/v2ray/v2ray-core/proxy/vmess" ) type StaticUser struct { - id *config.ID + id *vmess.ID } -func (this *StaticUser) ID() *config.ID { +func (this *StaticUser) ID() *vmess.ID { return this.id } -func (this *StaticUser) Level() config.UserLevel { - return config.UserLevelUntrusted +func (this *StaticUser) Level() vmess.UserLevel { + return vmess.UserLevelUntrusted } type StaticUserSet struct { } -func (us *StaticUserSet) AddUser(user config.User) error { +func (us *StaticUserSet) AddUser(user vmess.User) error { return nil } -func (us *StaticUserSet) GetUser(userhash []byte) (config.User, int64, bool) { - id, _ := config.NewID("703e9102-eb57-499c-8b59-faf4f371bb21") +func (us *StaticUserSet) GetUser(userhash []byte) (vmess.User, int64, bool) { + id, _ := vmess.NewID("703e9102-eb57-499c-8b59-faf4f371bb21") return &StaticUser{id: id}, 0, true } diff --git a/proxy/vmess/protocol/user/userset.go b/proxy/vmess/protocol/user/userset.go index 59c920311..e7a5e43f0 100644 --- a/proxy/vmess/protocol/user/userset.go +++ b/proxy/vmess/protocol/user/userset.go @@ -5,7 +5,7 @@ import ( "time" "github.com/v2ray/v2ray-core/common/collect" - "github.com/v2ray/v2ray-core/proxy/vmess/config" + "github.com/v2ray/v2ray-core/proxy/vmess" ) const ( @@ -14,12 +14,12 @@ const ( ) type UserSet interface { - AddUser(user config.User) error - GetUser(timeHash []byte) (config.User, int64, bool) + AddUser(user vmess.User) error + GetUser(timeHash []byte) (vmess.User, int64, bool) } type TimedUserSet struct { - validUsers []config.User + validUsers []vmess.User userHash map[string]indexTimePair userHashDeleteQueue *collect.TimedQueue access sync.RWMutex @@ -32,7 +32,7 @@ type indexTimePair struct { func NewTimedUserSet() UserSet { tus := &TimedUserSet{ - validUsers: make([]config.User, 0, 16), + validUsers: make([]vmess.User, 0, 16), userHash: make(map[string]indexTimePair, 512), userHashDeleteQueue: collect.NewTimedQueue(updateIntervalSec), access: sync.RWMutex{}, @@ -50,7 +50,7 @@ func (us *TimedUserSet) removeEntries(entries <-chan interface{}) { } } -func (us *TimedUserSet) generateNewHashes(lastSec, nowSec int64, idx int, id *config.ID) { +func (us *TimedUserSet) generateNewHashes(lastSec, nowSec int64, idx int, id *vmess.ID) { idHash := NewTimeHash(HMACHash{}) for lastSec < nowSec { idHash := idHash.Hash(id.Bytes[:], lastSec) @@ -74,7 +74,7 @@ func (us *TimedUserSet) updateUserHash(tick <-chan time.Time) { } } -func (us *TimedUserSet) AddUser(user config.User) error { +func (us *TimedUserSet) AddUser(user vmess.User) error { id := user.ID() idx := len(us.validUsers) us.validUsers = append(us.validUsers, user) @@ -86,7 +86,7 @@ func (us *TimedUserSet) AddUser(user config.User) error { return nil } -func (us *TimedUserSet) GetUser(userHash []byte) (config.User, int64, bool) { +func (us *TimedUserSet) GetUser(userHash []byte) (vmess.User, int64, bool) { defer us.access.RUnlock() us.access.RLock() pair, found := us.userHash[string(userHash)] diff --git a/proxy/vmess/protocol/vmess.go b/proxy/vmess/protocol/vmess.go index b9b371d57..408fb5933 100644 --- a/proxy/vmess/protocol/vmess.go +++ b/proxy/vmess/protocol/vmess.go @@ -12,7 +12,7 @@ import ( "github.com/v2ray/v2ray-core/common/log" v2net "github.com/v2ray/v2ray-core/common/net" proxyerrors "github.com/v2ray/v2ray-core/proxy/common/errors" - "github.com/v2ray/v2ray-core/proxy/vmess/config" + "github.com/v2ray/v2ray-core/proxy/vmess" "github.com/v2ray/v2ray-core/proxy/vmess/protocol/user" "github.com/v2ray/v2ray-core/transport" ) @@ -35,7 +35,7 @@ const ( // streaming. type VMessRequest struct { Version byte - User config.User + User vmess.User RequestIV []byte RequestKey []byte ResponseHeader []byte @@ -68,7 +68,7 @@ func NewVMessRequestReader(vUserSet user.UserSet) *VMessRequestReader { func (this *VMessRequestReader) Read(reader io.Reader) (*VMessRequest, error) { buffer := alloc.NewSmallBuffer() - nBytes, err := v2net.ReadAllBytes(reader, buffer.Value[:config.IDBytesLen]) + nBytes, err := v2net.ReadAllBytes(reader, buffer.Value[:vmess.IDBytesLen]) if err != nil { return nil, err } diff --git a/proxy/vmess/protocol/vmess_test.go b/proxy/vmess/protocol/vmess_test.go index 464c71229..ed6721283 100644 --- a/proxy/vmess/protocol/vmess_test.go +++ b/proxy/vmess/protocol/vmess_test.go @@ -7,7 +7,7 @@ import ( "testing" v2net "github.com/v2ray/v2ray-core/common/net" - "github.com/v2ray/v2ray-core/proxy/vmess/config" + "github.com/v2ray/v2ray-core/proxy/vmess" "github.com/v2ray/v2ray-core/proxy/vmess/protocol/user" "github.com/v2ray/v2ray-core/proxy/vmess/protocol/user/testing/mocks" v2testing "github.com/v2ray/v2ray-core/testing" @@ -15,22 +15,22 @@ import ( ) type TestUser struct { - id *config.ID - level config.UserLevel + id *vmess.ID + level vmess.UserLevel } -func (u *TestUser) ID() *config.ID { +func (u *TestUser) ID() *vmess.ID { return u.id } -func (this *TestUser) Level() config.UserLevel { +func (this *TestUser) Level() vmess.UserLevel { return this.level } func TestVMessSerialization(t *testing.T) { v2testing.Current(t) - userId, err := config.NewID("2b2966ac-16aa-4fbf-8d81-c5f172a3da51") + userId, err := vmess.NewID("2b2966ac-16aa-4fbf-8d81-c5f172a3da51") if err != nil { t.Fatal(err) } @@ -39,7 +39,7 @@ func TestVMessSerialization(t *testing.T) { id: userId, } - userSet := mocks.MockUserSet{[]config.User{}, make(map[string]int), make(map[string]int64)} + userSet := mocks.MockUserSet{[]vmess.User{}, make(map[string]int), make(map[string]int64)} userSet.AddUser(testUser) request := new(VMessRequest) @@ -90,8 +90,8 @@ func TestReadSingleByte(t *testing.T) { } func BenchmarkVMessRequestWriting(b *testing.B) { - userId, _ := config.NewID("2b2966ac-16aa-4fbf-8d81-c5f172a3da51") - userSet := mocks.MockUserSet{[]config.User{}, make(map[string]int), make(map[string]int64)} + userId, _ := vmess.NewID("2b2966ac-16aa-4fbf-8d81-c5f172a3da51") + userSet := mocks.MockUserSet{[]vmess.User{}, make(map[string]int), make(map[string]int64)} testUser := &TestUser{ id: userId, diff --git a/proxy/vmess/config/user.go b/proxy/vmess/user.go similarity index 96% rename from proxy/vmess/config/user.go rename to proxy/vmess/user.go index 0d407c1ba..7c234d082 100644 --- a/proxy/vmess/config/user.go +++ b/proxy/vmess/user.go @@ -1,4 +1,4 @@ -package config +package vmess type UserLevel int diff --git a/proxy/vmess/vmess.go b/proxy/vmess/vmess.go index 51036d5ca..dd86f516b 100644 --- a/proxy/vmess/vmess.go +++ b/proxy/vmess/vmess.go @@ -4,9 +4,3 @@ // together with 'freedom' to talk to final destination, while VMess outbound is usually used on // clients with 'socks' for proxying. package vmess - -// The actual implementation is in the following packages respectively. -import ( - _ "github.com/v2ray/v2ray-core/proxy/vmess/inbound" - _ "github.com/v2ray/v2ray-core/proxy/vmess/outbound" -) diff --git a/proxy/vmess/vmess_test.go b/proxy/vmess/vmess_test.go index 34968518d..7e99bf8ae 100644 --- a/proxy/vmess/vmess_test.go +++ b/proxy/vmess/vmess_test.go @@ -1,4 +1,4 @@ -package vmess +package vmess_test import ( "bytes" @@ -8,8 +8,12 @@ import ( v2nettesting "github.com/v2ray/v2ray-core/common/net/testing" "github.com/v2ray/v2ray-core/proxy/common/connhandler" proxymocks "github.com/v2ray/v2ray-core/proxy/testing/mocks" - "github.com/v2ray/v2ray-core/proxy/vmess/config" - "github.com/v2ray/v2ray-core/proxy/vmess/config/json" + vmess "github.com/v2ray/v2ray-core/proxy/vmess" + _ "github.com/v2ray/v2ray-core/proxy/vmess/inbound" + inboundjson "github.com/v2ray/v2ray-core/proxy/vmess/inbound/json" + vmessjson "github.com/v2ray/v2ray-core/proxy/vmess/json" + _ "github.com/v2ray/v2ray-core/proxy/vmess/outbound" + outboundjson "github.com/v2ray/v2ray-core/proxy/vmess/outbound/json" "github.com/v2ray/v2ray-core/shell/point" "github.com/v2ray/v2ray-core/shell/point/testing/mocks" v2testing "github.com/v2ray/v2ray-core/testing" @@ -19,7 +23,7 @@ import ( func TestVMessInAndOut(t *testing.T) { v2testing.Current(t) - testAccount, err := config.NewID("ad937d9d-6e23-4a5a-ba23-bce5092a7c51") + testAccount, err := vmess.NewID("ad937d9d-6e23-4a5a-ba23-bce5092a7c51") assert.Error(err).IsNil() portA := v2nettesting.PickPort() @@ -42,12 +46,12 @@ func TestVMessInAndOut(t *testing.T) { }, OutboundConfigValue: &mocks.ConnectionConfig{ ProtocolValue: "vmess", - SettingsValue: &json.Outbound{ - []*json.ConfigTarget{ - &json.ConfigTarget{ + SettingsValue: &outboundjson.Outbound{ + []*outboundjson.ConfigTarget{ + &outboundjson.ConfigTarget{ Address: v2net.IPAddress([]byte{127, 0, 0, 1}, portB), - Users: []*json.ConfigUser{ - &json.ConfigUser{Id: testAccount}, + Users: []*vmessjson.ConfigUser{ + &vmessjson.ConfigUser{Id: testAccount}, }, }, }, @@ -74,9 +78,9 @@ func TestVMessInAndOut(t *testing.T) { PortValue: portB, InboundConfigValue: &mocks.ConnectionConfig{ ProtocolValue: "vmess", - SettingsValue: &json.Inbound{ - AllowedClients: []*json.ConfigUser{ - &json.ConfigUser{Id: testAccount}, + SettingsValue: &inboundjson.Inbound{ + AllowedClients: []*vmessjson.ConfigUser{ + &vmessjson.ConfigUser{Id: testAccount}, }, }, }, diff --git a/release/server/main.go b/release/server/main.go index 59cc2d80d..be2a9d9b2 100644 --- a/release/server/main.go +++ b/release/server/main.go @@ -23,8 +23,10 @@ import ( _ "github.com/v2ray/v2ray-core/proxy/freedom/json" _ "github.com/v2ray/v2ray-core/proxy/socks" _ "github.com/v2ray/v2ray-core/proxy/socks/json" - _ "github.com/v2ray/v2ray-core/proxy/vmess" - _ "github.com/v2ray/v2ray-core/proxy/vmess/config/json" + _ "github.com/v2ray/v2ray-core/proxy/vmess/inbound" + _ "github.com/v2ray/v2ray-core/proxy/vmess/inbound/json" + _ "github.com/v2ray/v2ray-core/proxy/vmess/outbound" + _ "github.com/v2ray/v2ray-core/proxy/vmess/outbound/json" ) var ( diff --git a/shell/point/json/json_test.go b/shell/point/json/json_test.go index 4e4c61e6d..3933aa692 100644 --- a/shell/point/json/json_test.go +++ b/shell/point/json/json_test.go @@ -9,7 +9,8 @@ import ( _ "github.com/v2ray/v2ray-core/proxy/dokodemo/json" _ "github.com/v2ray/v2ray-core/proxy/freedom/json" _ "github.com/v2ray/v2ray-core/proxy/socks/json" - _ "github.com/v2ray/v2ray-core/proxy/vmess/config/json" + _ "github.com/v2ray/v2ray-core/proxy/vmess/inbound/json" + _ "github.com/v2ray/v2ray-core/proxy/vmess/outbound/json" "github.com/v2ray/v2ray-core/shell/point/json" v2testing "github.com/v2ray/v2ray-core/testing" diff --git a/testing/scenarios/server_env.go b/testing/scenarios/server_env.go index fe699006e..b6cf140fa 100644 --- a/testing/scenarios/server_env.go +++ b/testing/scenarios/server_env.go @@ -20,8 +20,10 @@ import ( _ "github.com/v2ray/v2ray-core/proxy/freedom/json" _ "github.com/v2ray/v2ray-core/proxy/socks" _ "github.com/v2ray/v2ray-core/proxy/socks/json" - _ "github.com/v2ray/v2ray-core/proxy/vmess" - _ "github.com/v2ray/v2ray-core/proxy/vmess/config/json" + _ "github.com/v2ray/v2ray-core/proxy/vmess/inbound" + _ "github.com/v2ray/v2ray-core/proxy/vmess/inbound/json" + _ "github.com/v2ray/v2ray-core/proxy/vmess/outbound" + _ "github.com/v2ray/v2ray-core/proxy/vmess/outbound/json" ) var (