Merge branch 'master' into 2725

pull/2725/head
Kslr 4 years ago committed by GitHub
commit d7a5f01520
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1 @@
Please Move to https://github.com/v2fly/v2ray-core/pulls

@ -184,3 +184,4 @@ func (m *Manager) Start() error {
func (m *Manager) Close() error { func (m *Manager) Close() error {
return nil return nil
} }

@ -38,6 +38,7 @@ type Manager interface {
// RegisterCounter registers a new counter to the manager. The identifier string must not be empty, and unique among other counters. // RegisterCounter registers a new counter to the manager. The identifier string must not be empty, and unique among other counters.
RegisterCounter(string) (Counter, error) RegisterCounter(string) (Counter, error)
UnregisterCounter(string) error
// GetCounter returns a counter by its identifier. // GetCounter returns a counter by its identifier.
GetCounter(string) Counter GetCounter(string) Counter
@ -87,6 +88,11 @@ func (NoopManager) RegisterCounter(string) (Counter, error) {
return nil, newError("not implemented") return nil, newError("not implemented")
} }
// UnregisterCounter implements Manager.
func (NoopManager) UnregisterCounter(string) error {
return newError("not implemented")
}
// GetCounter implements Manager. // GetCounter implements Manager.
func (NoopManager) GetCounter(string) Counter { func (NoopManager) GetCounter(string) Counter {
return nil return nil

@ -111,7 +111,7 @@ Start:
if len(s.config.Accounts) > 0 { if len(s.config.Accounts) > 0 {
user, pass, ok := parseBasicAuth(request.Header.Get("Proxy-Authorization")) user, pass, ok := parseBasicAuth(request.Header.Get("Proxy-Authorization"))
if !ok || !s.config.HasAccount(user, pass) { if !ok || !s.config.HasAccount(user, pass) {
return common.Error2(conn.Write([]byte("HTTP/1.1 407 Proxy Authentication Required\r\nProxy-Authenticate: Basic realm=\"proxy\"\r\n\r\n"))) return common.Error2(conn.Write([]byte("HTTP/1.1 407 Proxy Authentication Required\r\nProxy-Authenticate: Basic realm=\"proxy\"\r\nConnection: close\r\n\r\n")))
} }
if inbound != nil { if inbound != nil {
inbound.User.Email = user inbound.User.Email = user

@ -190,13 +190,12 @@ func (v *TimedUserValidator) Remove(email string) bool {
v.Lock() v.Lock()
defer v.Unlock() defer v.Unlock()
email = strings.ToLower(email)
idx := -1 idx := -1
for i, u := range v.users { for i := range v.users {
if strings.EqualFold(u.user.Email, email) { if strings.EqualFold(v.users[i].user.Email, email) {
idx = i idx = i
var cmdkeyfl [16]byte var cmdkeyfl [16]byte
copy(cmdkeyfl[:], u.user.Account.(*MemoryAccount).ID.CmdKey()) copy(cmdkeyfl[:], v.users[i].user.Account.(*MemoryAccount).ID.CmdKey())
v.aeadDecoderHolder.RemoveUser(cmdkeyfl) v.aeadDecoderHolder.RemoveUser(cmdkeyfl)
break break
} }

Loading…
Cancel
Save