mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-02 16:21:05 +00:00
re-org vmess content
This commit is contained in:
1 parent
0a4d9fb037
commit
af8412175e
24 files changed
+113
-108
No files matched your search
@@ -0,0 +1,9 @@
|
||||
package inbound
|
||||
|
||||
import (
|
||||
"github.com/v2ray/v2ray-core/proxy/vmess"
|
||||
)
|
||||
|
||||
type Config interface {
|
||||
AllowedUsers() []vmess.User
|
||||
}
|
||||
@@ -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() {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package json
|
||||
|
||||
import (
|
||||
"github.com/v2ray/v2ray-core/proxy/common/config/json"
|
||||
"github.com/v2ray/v2ray-core/proxy/vmess"
|
||||
vmessjson "github.com/v2ray/v2ray-core/proxy/vmess/json"
|
||||
)
|
||||
|
||||
type Inbound struct {
|
||||
AllowedClients []*vmessjson.ConfigUser `json:"clients"`
|
||||
}
|
||||
|
||||
func (c *Inbound) AllowedUsers() []vmess.User {
|
||||
users := make([]vmess.User, 0, len(c.AllowedClients))
|
||||
for _, rawUser := range c.AllowedClients {
|
||||
users = append(users, rawUser)
|
||||
}
|
||||
return users
|
||||
}
|
||||
|
||||
func init() {
|
||||
json.RegisterInboundConnectionConfig("vmess", func() interface{} {
|
||||
return new(Inbound)
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user