Merge pull request #20 from wyx2685/master

fix bug: func RouterFromContext return nil router
This commit is contained in:
Yuzuki 2023-09-29 18:18:57 +08:00 committed by GitHub
commit 1b591e2906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -1,7 +1,6 @@
package sing
import (
"context"
"crypto/rand"
"encoding/base64"
"fmt"
@ -215,8 +214,9 @@ func (b *Box) AddNode(tag string, info *panel.NodeInfo, config *conf.Options) er
if err != nil {
return err
}
in, err := inbound.New(
context.Background(),
b.ctx,
b.router,
b.logFactory.NewLogger(F.ToString("inbound/", c.Type, "[", tag, "]")),
c,

View File

@ -31,6 +31,7 @@ type DNSConfig struct {
}
type Box struct {
ctx context.Context
createdAt time.Time
router adapter.Router
inbounds map[string]adapter.Inbound
@ -169,6 +170,7 @@ func New(c *conf.CoreConfig) (vCore.Core, error) {
}
router.SetClashServer(server)
return &Box{
ctx: ctx,
router: router,
inbounds: inMap,
outbounds: outbounds,