Skip to content

Commit

Permalink
Merge pull request #642 from getlantern/reflog/vmess-doc
Browse files Browse the repository at this point in the history
added vmess documentation
  • Loading branch information
reflog authored Jan 7, 2025
2 parents 680adb8 + 35fe02e commit afcb0af
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion http_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ func (p *Proxy) listenVMess(baseListen func(string) (net.Listener, error)) liste
log.Debugf("Listening for vmess at %v", base.Addr())
wrapper, err := vmess.NewVMessListener(base, p.VMessUUIDs)
if err != nil {
base.Close()
_ = base.Close()
return nil, fmt.Errorf("vmess wrapping error: %w", err)
}

Expand Down
6 changes: 6 additions & 0 deletions v2ray/vmess/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ type listener struct {
service *vmess.Service[int]
}

// NewVMessListener wraps a net.Listener with a VMess service
// VMess is used only for obfuscation, not for transport, thus the destination is not read from VMess header
// VMess will accept connections only from users that are identified by UUIDs passed here
// The UUIDs are generated on route setup and stored in the database, there could be several UUIDs per proxy
// The UUIDs will be distributed between the users. There is no 1-1 mapping between UUIDs and users and this is just
// intended as a source of extra entropy
func NewVMessListener(baseListener net.Listener, uuids []string) (net.Listener, error) {
var userNum []int
var userAlt []int
Expand Down

0 comments on commit afcb0af

Please sign in to comment.