Skip to content

Commit

Permalink
complete original config support for sing, fix DelUsers for vless
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuzuki616 committed Aug 25, 2023
1 parent f6b4c04 commit cb868c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/sing/sing.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sing
import (
"context"
"fmt"
"github.com/goccy/go-json"
"io"
"os"
"runtime/debug"
Expand Down Expand Up @@ -41,6 +42,17 @@ func init() {

func New(c *conf.CoreConfig) (vCore.Core, error) {
options := option.Options{}
if len(c.SingConfig.OriginalPath) != 0 {
f, err := os.Open(c.SingConfig.OriginalPath)
if err != nil {
return nil, fmt.Errorf("open original config error: %s", err)
}
defer f.Close()
err = json.NewDecoder(f).Decode(options)
if err != nil {
return nil, fmt.Errorf("decode original config error: %s", err)
}
}
options.Log = &option.LogOptions{
Disabled: c.SingConfig.LogConfig.Disabled,
Level: c.SingConfig.LogConfig.Level,
Expand Down
2 changes: 2 additions & 0 deletions core/sing/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ func (b *Box) DelUsers(users []panel.UserInfo, tag string) error {
switch i.Type() {
case "vmess":
del = i.(*inbound.VMess)
case "vless":
del = i.(*inbound.VLESS)
case "shadowsocks":
del = i.(*inbound.ShadowsocksMulti)
case "trojan":
Expand Down

0 comments on commit cb868c7

Please sign in to comment.