𐲓𐳛𐳪𐳂𐳐 𐲀𐳢𐳦𐳫𐳢 𐲥𐳔𐳛𐳪𐳌𐳑𐳖𐳇
2026-05-29 23:04:59 +08:00
committed by GitHub
parent ca4b156b57
commit d43a808ea5
114 changed files with 736 additions and 378 deletions
+5 -6
View File
@@ -3,15 +3,15 @@ package commander
import (
"context"
"net"
"strings"
"sync"
"strings"
"github.com/xtls/xray-core/common"
"github.com/xtls/xray-core/common/errors"
"github.com/xtls/xray-core/common/signal/done"
core "github.com/xtls/xray-core/core"
"github.com/xtls/xray-core/features/outbound"
"github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet"
"google.golang.org/grpc"
)
@@ -69,16 +69,15 @@ func (c *Commander) Start() error {
}
c.Unlock()
var listen = func(listener net.Listener) {
listen := func(listener net.Listener) {
if err := c.server.Serve(listener); err != nil {
errors.LogErrorInner(context.Background(), err, "failed to start grpc server")
}
}
if len(c.listen) > 0 {
var addr net.Addr
if strings.HasPrefix(c.listen, "/") || strings.HasPrefix(c.listen, "@") {
addr = &net.UnixAddr{Name: c.listen, Net: "unix"}
} else {
@@ -89,7 +88,7 @@ func (c *Commander) Start() error {
}
addr = tcpAddr
}
l, err := internet.ListenSystem(context.Background(), addr, nil)
l, err := internet.ListenSystem(context.Background(), addr, nil)
if err != nil {
errors.LogErrorInner(context.Background(), err, "API server failed to listen on ", c.listen)
return err