Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehco1996 committed Aug 24, 2019
1 parent fc317e3 commit 0244335
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export V2SCAR_GRPC_ENDPOINT="127.0.0.1:8080" # 这个是机器上v2ray开放的g

> 这只是一份参考的配置,
> 关键的部分在于`stats/api/policy/routing`
> 另外如果需要对接 django-sspanel的话,配置里的inbound的`port/tag`必须和面板后台里的配置相同
> 另外如果需要对接 django-sspanel的话,配置里的inbound的`port/tag/level`必须和面板后台里的配置相同
```json
{
Expand Down
1 change: 1 addition & 0 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
var SYNC_TIME = 60

func main() {
// TODO v2ray重启了,sidecar会挂

app := cli.NewApp()
app.Name = "v2scar"
Expand Down
4 changes: 3 additions & 1 deletion cronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ func initOrUpdateUser(up *UserPool, c v2proxyman.HandlerServiceClient, sr *syncR
if err != nil {
log.Fatalln(err)
}
AddInboundUser(c, sr.Tag, newUser)
if newUser.Enable {
AddInboundUser(c, sr.Tag, newUser)
}
} else {
// Old User
if user.Enable != cfg.Enable {
Expand Down
5 changes: 3 additions & 2 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v2scar

import (
"errors"
"fmt"
"sync"
"sync/atomic"
)
Expand Down Expand Up @@ -66,7 +67,7 @@ func (up *UserPool) CreateUser(email, uuid string, level, alterId uint32, enable
defer up.access.Unlock()

if user, found := up.users[email]; found {
return user, errors.New("User Already Exists")
return user, errors.New(fmt.Sprintf("User Already Exists Email: %s", email))
} else {
user := newUser(email, uuid, level, alterId, enable)
up.users[user.Email] = user
Expand All @@ -82,7 +83,7 @@ func (up *UserPool) GetUserByEmail(email string) (*User, error) {
if user, found := up.users[email]; found {
return user, nil
} else {
return nil, errors.New("User Not Found")
return nil, errors.New(fmt.Sprintf("User Not Found Email: %s", email))
}
}

Expand Down
2 changes: 1 addition & 1 deletion v2ray-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"policy": {
"levels": {
"0": {
"3": {
"handshake": 4,
"connIdle": 300,
"uplinkOnly": 2,
Expand Down

0 comments on commit 0244335

Please # to comment.