识别您的特殊用户列表格式
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/netip"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -16,6 +17,7 @@ import (
|
||||
"github.com/sagernet/sing-box/log"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
"github.com/sagernet/sing-box/service/ssmapi"
|
||||
"github.com/sagernet/sing/common"
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
"github.com/sagernet/sing/common/json/badoption"
|
||||
"github.com/sagernet/sing/service"
|
||||
@@ -248,14 +250,19 @@ func (s *Service) setupNode() error {
|
||||
|
||||
s.logger.Info("Xboard protocol identified: ", protocol)
|
||||
|
||||
listenAddr := badoption.ParseAddr(inner.ListenIP)
|
||||
var listenAddr *badoption.Addr
|
||||
if addr, err := netip.ParseAddr(inner.ListenIP); err == nil {
|
||||
listenAddr = common.Ptr(badoption.Addr(addr))
|
||||
} else {
|
||||
listenAddr = common.Ptr(badoption.Addr(netip.IPv4Unspecified()))
|
||||
}
|
||||
|
||||
var inboundOptions any
|
||||
switch protocol {
|
||||
case "vless":
|
||||
vlessOptions := option.VLESSInboundOptions{
|
||||
ListenOptions: option.ListenOptions{
|
||||
Listen: &listenAddr,
|
||||
Listen: listenAddr,
|
||||
ListenPort: uint16(inner.Port),
|
||||
},
|
||||
}
|
||||
@@ -290,7 +297,7 @@ func (s *Service) setupNode() error {
|
||||
case "vmess":
|
||||
vmessOptions := option.VMessInboundOptions{
|
||||
ListenOptions: option.ListenOptions{
|
||||
Listen: &listenAddr,
|
||||
Listen: listenAddr,
|
||||
ListenPort: uint16(inner.Port),
|
||||
},
|
||||
}
|
||||
@@ -298,7 +305,7 @@ func (s *Service) setupNode() error {
|
||||
case "shadowsocks":
|
||||
ssOptions := option.ShadowsocksInboundOptions{
|
||||
ListenOptions: option.ListenOptions{
|
||||
Listen: &listenAddr,
|
||||
Listen: listenAddr,
|
||||
ListenPort: uint16(inner.Port),
|
||||
},
|
||||
Method: inner.Cipher,
|
||||
@@ -308,7 +315,7 @@ func (s *Service) setupNode() error {
|
||||
case "trojan":
|
||||
trojanOptions := option.TrojanInboundOptions{
|
||||
ListenOptions: option.ListenOptions{
|
||||
Listen: &listenAddr,
|
||||
Listen: listenAddr,
|
||||
ListenPort: uint16(inner.Port),
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user