Inbound rule support

This commit is contained in:
世界
2022-07-02 14:07:50 +08:00
parent 9f4c0ff624
commit 7c57eb70e8
34 changed files with 622 additions and 247 deletions

View File

@@ -8,7 +8,7 @@ import (
"syscall"
"github.com/sagernet/sing-box"
"github.com/sagernet/sing-box/config"
"github.com/sagernet/sing-box/option"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
@@ -36,13 +36,14 @@ func run(cmd *cobra.Command, args []string) {
if err != nil {
logrus.Fatal("read config: ", err)
}
var boxConfig config.Config
err = json.Unmarshal(configContent, &boxConfig)
var options option.Options
err = json.Unmarshal(configContent, &options)
if err != nil {
logrus.Fatal("parse config: ", err)
}
ctx, cancel := context.WithCancel(context.Background())
service, err := box.NewService(ctx, &boxConfig)
service, err := box.NewService(ctx, &options)
if err != nil {
logrus.Fatal("create service: ", err)
}