mirror of
https://github.com/wyx2685/V2bX.git
synced 2026-02-04 20:50:09 +00:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e502624fe4 | ||
|
|
484faaf0c3 | ||
|
|
ec5dcc3c8a | ||
|
|
2f1362067b | ||
|
|
c755e9800b | ||
|
|
29e0d7e56e | ||
|
|
08ebbed9fb | ||
|
|
792841d073 | ||
|
|
981e59b836 | ||
|
|
7dbe5fda85 | ||
|
|
4f9ccdf8db | ||
|
|
c2d5861d7d | ||
|
|
0e29c19f0e | ||
|
|
a1c40bb1c8 | ||
|
|
a0de94efff | ||
|
|
29928a1135 |
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
@@ -125,13 +125,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "version: $version"
|
echo "version: $version"
|
||||||
mkdir -p build_assets
|
mkdir -p build_assets
|
||||||
go build -v -o build_assets/V2bX -tags "sing xray hysteria2 with_reality_server with_quic with_grpc with_utls with_wireguard with_acme" -trimpath -ldflags "-X 'github.com/InazumaV/V2bX/cmd.version=$version' -s -w -buildid="
|
go build -v -o build_assets/V2bX -tags "sing xray hysteria2 with_reality_server with_quic with_grpc with_utls with_wireguard with_acme with_gvisor" -trimpath -ldflags "-X 'github.com/InazumaV/V2bX/cmd.version=$version' -s -w -buildid="
|
||||||
|
|
||||||
- name: Build Mips softfloat V2bX
|
- name: Build Mips softfloat V2bX
|
||||||
if: matrix.goarch == 'mips' || matrix.goarch == 'mipsle'
|
if: matrix.goarch == 'mips' || matrix.goarch == 'mipsle'
|
||||||
run: |
|
run: |
|
||||||
echo "version: $version"
|
echo "version: $version"
|
||||||
GOMIPS=softfloat go build -v -o build_assets/V2bX_softfloat -tags "sing xray hysteria2 with_reality_server with_quic with_grpc with_utls with_wireguard with_acme" -trimpath -ldflags "-X 'github.com/InazumaV/V2bX/cmd.version=$version' -s -w -buildid="
|
GOMIPS=softfloat go build -v -o build_assets/V2bX_softfloat -tags "sing xray hysteria2 with_reality_server with_quic with_grpc with_utls with_wireguard with_acme with_gvisor" -trimpath -ldflags "-X 'github.com/InazumaV/V2bX/cmd.version=$version' -s -w -buildid="
|
||||||
- name: Rename Windows V2bX
|
- name: Rename Windows V2bX
|
||||||
if: matrix.goos == 'windows'
|
if: matrix.goos == 'windows'
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ WORKDIR /app
|
|||||||
COPY . .
|
COPY . .
|
||||||
ENV CGO_ENABLED=0
|
ENV CGO_ENABLED=0
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
RUN go build -v -o V2bX -tags "sing xray hysteria2 with_reality_server with_quic with_grpc with_utls with_wireguard with_acme"
|
RUN go build -v -o V2bX -tags "sing xray hysteria2 with_reality_server with_quic with_grpc with_utls with_wireguard with_acme with_gvisor"
|
||||||
|
|
||||||
# Release
|
# Release
|
||||||
FROM alpine
|
FROM alpine
|
||||||
|
|||||||
@@ -109,10 +109,11 @@ type HysteriaNode struct {
|
|||||||
|
|
||||||
type Hysteria2Node struct {
|
type Hysteria2Node struct {
|
||||||
CommonNode
|
CommonNode
|
||||||
UpMbps int `json:"up_mbps"`
|
Ignore_Client_Bandwidth bool `json:"ignore_client_bandwidth"`
|
||||||
DownMbps int `json:"down_mbps"`
|
UpMbps int `json:"up_mbps"`
|
||||||
ObfsType string `json:"obfs"`
|
DownMbps int `json:"down_mbps"`
|
||||||
ObfsPassword string `json:"obfs-password"`
|
ObfsType string `json:"obfs"`
|
||||||
|
ObfsPassword string `json:"obfs-password"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RawDNS struct {
|
type RawDNS struct {
|
||||||
|
|||||||
@@ -56,23 +56,24 @@ func (c *Client) GetUserList() ([]UserInfo, error) {
|
|||||||
|
|
||||||
// GetUserAlive will fetch the alive_ip count for users
|
// GetUserAlive will fetch the alive_ip count for users
|
||||||
func (c *Client) GetUserAlive() (map[int]int, error) {
|
func (c *Client) GetUserAlive() (map[int]int, error) {
|
||||||
|
c.AliveMap = &AliveMap{}
|
||||||
const path = "/api/v1/server/UniProxy/alivelist"
|
const path = "/api/v1/server/UniProxy/alivelist"
|
||||||
r, err := c.client.R().
|
r, err := c.client.R().
|
||||||
ForceContentType("application/json").
|
ForceContentType("application/json").
|
||||||
Get(path)
|
Get(path)
|
||||||
if r == nil || r.RawResponse == nil {
|
|
||||||
return nil, fmt.Errorf("received nil response or raw response")
|
|
||||||
}
|
|
||||||
defer r.RawResponse.Body.Close()
|
|
||||||
|
|
||||||
c.AliveMap = &AliveMap{}
|
|
||||||
if err != nil || r.StatusCode() >= 399 {
|
if err != nil || r.StatusCode() >= 399 {
|
||||||
c.AliveMap.Alive = make(map[int]int)
|
c.AliveMap.Alive = make(map[int]int)
|
||||||
return c.AliveMap.Alive, nil
|
return c.AliveMap.Alive, nil
|
||||||
}
|
}
|
||||||
|
if r == nil || r.RawResponse == nil {
|
||||||
|
fmt.Printf("received nil response or raw response")
|
||||||
|
c.AliveMap.Alive = make(map[int]int)
|
||||||
|
return c.AliveMap.Alive, nil
|
||||||
|
}
|
||||||
|
defer r.RawResponse.Body.Close()
|
||||||
if err := json.Unmarshal(r.Body(), c.AliveMap); err != nil {
|
if err := json.Unmarshal(r.Body(), c.AliveMap); err != nil {
|
||||||
return nil, fmt.Errorf("unmarshal user alive list error: %s", err)
|
fmt.Printf("unmarshal user alive list error: %s", err)
|
||||||
|
c.AliveMap.Alive = make(map[int]int)
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.AliveMap.Alive, nil
|
return c.AliveMap.Alive, nil
|
||||||
|
|||||||
25
conf/sing.go
25
conf/sing.go
@@ -5,10 +5,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SingConfig struct {
|
type SingConfig struct {
|
||||||
LogConfig SingLogConfig `json:"Log"`
|
LogConfig SingLogConfig `json:"Log"`
|
||||||
NtpConfig SingNtpConfig `json:"NTP"`
|
NtpConfig SingNtpConfig `json:"NTP"`
|
||||||
EnableConnClear bool `json:"EnableConnClear"`
|
OriginalPath string `json:"OriginalPath"`
|
||||||
OriginalPath string `json:"OriginalPath"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type SingLogConfig struct {
|
type SingLogConfig struct {
|
||||||
@@ -33,13 +32,13 @@ func NewSingConfig() *SingConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SingOptions struct {
|
type SingOptions struct {
|
||||||
EnableProxyProtocol bool `json:"EnableProxyProtocol"`
|
|
||||||
TCPFastOpen bool `json:"EnableTFO"`
|
TCPFastOpen bool `json:"EnableTFO"`
|
||||||
SniffEnabled bool `json:"EnableSniff"`
|
SniffEnabled bool `json:"EnableSniff"`
|
||||||
|
SniffOverrideDestination bool `json:"SniffOverrideDestination"`
|
||||||
EnableDNS bool `json:"EnableDNS"`
|
EnableDNS bool `json:"EnableDNS"`
|
||||||
DomainStrategy option.DomainStrategy `json:"DomainStrategy"`
|
DomainStrategy option.DomainStrategy `json:"DomainStrategy"`
|
||||||
SniffOverrideDestination bool `json:"SniffOverrideDestination"`
|
|
||||||
FallBackConfigs *FallBackConfigForSing `json:"FallBackConfigs"`
|
FallBackConfigs *FallBackConfigForSing `json:"FallBackConfigs"`
|
||||||
|
Multiplex *MultiplexConfig `json:"MultiplexConfig"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SingNtpConfig struct {
|
type SingNtpConfig struct {
|
||||||
@@ -59,13 +58,25 @@ type FallBack struct {
|
|||||||
ServerPort string `json:"ServerPort"`
|
ServerPort string `json:"ServerPort"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MultiplexConfig struct {
|
||||||
|
Enabled bool `json:"Enable"`
|
||||||
|
Padding bool `json:"Padding"`
|
||||||
|
Brutal BrutalOptions `json:"Brutal"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BrutalOptions struct {
|
||||||
|
Enabled bool `json:"Enable"`
|
||||||
|
UpMbps int `json:"UpMbps"`
|
||||||
|
DownMbps int `json:"DownMbps"`
|
||||||
|
}
|
||||||
|
|
||||||
func NewSingOptions() *SingOptions {
|
func NewSingOptions() *SingOptions {
|
||||||
return &SingOptions{
|
return &SingOptions{
|
||||||
EnableDNS: false,
|
EnableDNS: false,
|
||||||
EnableProxyProtocol: false,
|
|
||||||
TCPFastOpen: false,
|
TCPFastOpen: false,
|
||||||
SniffEnabled: true,
|
SniffEnabled: true,
|
||||||
SniffOverrideDestination: true,
|
SniffOverrideDestination: true,
|
||||||
FallBackConfigs: &FallBackConfigForSing{},
|
FallBackConfigs: &FallBackConfigForSing{},
|
||||||
|
Multiplex: &MultiplexConfig{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ func (n *Hysteria2node) getMasqHandler(tlsconfig *server.TLSConfig, conn net.Pac
|
|||||||
req.Header.Set("X-Forwarded-For", clientIP)
|
req.Header.Set("X-Forwarded-For", clientIP)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !c.Masquerade.Proxy.RewriteHost {
|
if c.Masquerade.Proxy.RewriteHost {
|
||||||
req.Host = req.URL.Host
|
req.Host = req.URL.Host
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -342,7 +342,7 @@ func (n *Hysteria2node) getMasqHandler(tlsconfig *server.TLSConfig, conn net.Pac
|
|||||||
s := masq.MasqTCPServer{
|
s := masq.MasqTCPServer{
|
||||||
QUICPort: extractPortFromAddr(conn.LocalAddr().String()),
|
QUICPort: extractPortFromAddr(conn.LocalAddr().String()),
|
||||||
HTTPSPort: extractPortFromAddr(c.Masquerade.ListenHTTPS),
|
HTTPSPort: extractPortFromAddr(c.Masquerade.ListenHTTPS),
|
||||||
Handler: &masqHandlerLogWrapper{H: handler, QUIC: false},
|
Handler: &masqHandlerLogWrapper{H: handler, QUIC: false, Logger: n.Logger},
|
||||||
TLSConfig: &tls.Config{
|
TLSConfig: &tls.Config{
|
||||||
Certificates: tlsconfig.Certificates,
|
Certificates: tlsconfig.Certificates,
|
||||||
GetCertificate: tlsconfig.GetCertificate,
|
GetCertificate: tlsconfig.GetCertificate,
|
||||||
@@ -382,7 +382,7 @@ func (n *Hysteria2node) getHyConfig(info *panel.NodeInfo, config *conf.Options,
|
|||||||
Conn: conn,
|
Conn: conn,
|
||||||
Outbound: Outbound,
|
Outbound: Outbound,
|
||||||
BandwidthConfig: *n.getBandwidthConfig(info),
|
BandwidthConfig: *n.getBandwidthConfig(info),
|
||||||
IgnoreClientBandwidth: c.IgnoreClientBandwidth,
|
IgnoreClientBandwidth: info.Hysteria2.Ignore_Client_Bandwidth,
|
||||||
DisableUDP: c.DisableUDP,
|
DisableUDP: c.DisableUDP,
|
||||||
UDPIdleTimeout: c.UDPIdleTimeout,
|
UDPIdleTimeout: c.UDPIdleTimeout,
|
||||||
EventLogger: n.EventLogger,
|
EventLogger: n.EventLogger,
|
||||||
|
|||||||
@@ -6,15 +6,25 @@ import (
|
|||||||
"github.com/InazumaV/V2bX/common/counter"
|
"github.com/InazumaV/V2bX/common/counter"
|
||||||
"github.com/InazumaV/V2bX/common/format"
|
"github.com/InazumaV/V2bX/common/format"
|
||||||
"github.com/InazumaV/V2bX/limiter"
|
"github.com/InazumaV/V2bX/limiter"
|
||||||
|
"github.com/apernet/hysteria/core/v2/server"
|
||||||
|
quic "github.com/apernet/quic-go"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ server.TrafficLogger = (*HookServer)(nil)
|
||||||
|
|
||||||
type HookServer struct {
|
type HookServer struct {
|
||||||
Tag string
|
Tag string
|
||||||
logger *zap.Logger
|
logger *zap.Logger
|
||||||
Counter sync.Map
|
Counter sync.Map
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *HookServer) TraceStream(stream quic.Stream, stats *server.StreamStats) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *HookServer) UntraceStream(stream quic.Stream) {
|
||||||
|
}
|
||||||
|
|
||||||
func (h *HookServer) LogTraffic(id string, tx, rx uint64) (ok bool) {
|
func (h *HookServer) LogTraffic(id string, tx, rx uint64) (ok bool) {
|
||||||
var c interface{}
|
var c interface{}
|
||||||
var exists bool
|
var exists bool
|
||||||
|
|||||||
@@ -120,11 +120,11 @@ func (l *serverLogger) UDPError(addr net.Addr, uuid string, sessionId uint32, er
|
|||||||
func initLogger(logLevel string, logFormat string) (*zap.Logger, error) {
|
func initLogger(logLevel string, logFormat string) (*zap.Logger, error) {
|
||||||
level, ok := logLevelMap[strings.ToLower(logLevel)]
|
level, ok := logLevelMap[strings.ToLower(logLevel)]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf(fmt.Sprintf("unsupported log level: %s\n", logLevel))
|
return nil, fmt.Errorf("unsupported log level: %s", logLevel)
|
||||||
}
|
}
|
||||||
enc, ok := logFormatMap[strings.ToLower(logFormat)]
|
enc, ok := logFormatMap[strings.ToLower(logFormat)]
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf(fmt.Sprintf("unsupported log format: %s\n", logFormat))
|
return nil, fmt.Errorf("unsupported log format: %s", logFormat)
|
||||||
}
|
}
|
||||||
c := zap.Config{
|
c := zap.Config{
|
||||||
Level: zap.NewAtomicLevelAt(level),
|
Level: zap.NewAtomicLevelAt(level),
|
||||||
@@ -137,7 +137,7 @@ func initLogger(logLevel string, logFormat string) (*zap.Logger, error) {
|
|||||||
}
|
}
|
||||||
logger, err := c.Build()
|
logger, err := c.Build()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf(fmt.Sprintf("failed to initialize logger: %s\n", err))
|
return nil, fmt.Errorf("failed to initialize logger: %s", err)
|
||||||
}
|
}
|
||||||
return logger, nil
|
return logger, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ func (h *Hysteria2) AddUsers(p *vCore.AddUsersParams) (added int, err error) {
|
|||||||
return len(p.Users), nil
|
return len(p.Users), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Hysteria2) DelUsers(users []panel.UserInfo, tag string) error {
|
func (h *Hysteria2) DelUsers(users []panel.UserInfo, tag string, _ *panel.NodeInfo) error {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
for _, user := range users {
|
for _, user := range users {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type Core interface {
|
|||||||
DelNode(tag string) error
|
DelNode(tag string) error
|
||||||
AddUsers(p *AddUsersParams) (added int, err error)
|
AddUsers(p *AddUsersParams) (added int, err error)
|
||||||
GetUserTraffic(tag, uuid string, reset bool) (up int64, down int64)
|
GetUserTraffic(tag, uuid string, reset bool) (up int64, down int64)
|
||||||
DelUsers(users []panel.UserInfo, tag string) error
|
DelUsers(users []panel.UserInfo, tag string, info *panel.NodeInfo) error
|
||||||
Protocols() []string
|
Protocols() []string
|
||||||
Type() string
|
Type() string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ package core
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/hashicorp/go-multierror"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/hashicorp/go-multierror"
|
||||||
|
|
||||||
"github.com/InazumaV/V2bX/api/panel"
|
"github.com/InazumaV/V2bX/api/panel"
|
||||||
"github.com/InazumaV/V2bX/conf"
|
"github.com/InazumaV/V2bX/conf"
|
||||||
)
|
)
|
||||||
@@ -135,12 +136,12 @@ func (s *Selector) GetUserTraffic(tag, uuid string, reset bool) (up int64, down
|
|||||||
return t.(Core).GetUserTraffic(tag, uuid, reset)
|
return t.(Core).GetUserTraffic(tag, uuid, reset)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Selector) DelUsers(users []panel.UserInfo, tag string) error {
|
func (s *Selector) DelUsers(users []panel.UserInfo, tag string, info *panel.NodeInfo) error {
|
||||||
t, e := s.nodes.Load(tag)
|
t, e := s.nodes.Load(tag)
|
||||||
if !e {
|
if !e {
|
||||||
return errors.New("the node is not have")
|
return errors.New("the node is not have")
|
||||||
}
|
}
|
||||||
return t.(Core).DelUsers(users, tag)
|
return t.(Core).DelUsers(users, tag, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Selector) Protocols() []string {
|
func (s *Selector) Protocols() []string {
|
||||||
|
|||||||
@@ -1,85 +0,0 @@
|
|||||||
package sing
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"github.com/InazumaV/V2bX/api/panel"
|
|
||||||
"github.com/goccy/go-json"
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
func updateDNSConfig(node *panel.NodeInfo) (err error) {
|
|
||||||
dnsPath := os.Getenv("SING_DNS_PATH")
|
|
||||||
if len(node.RawDNS.DNSJson) != 0 {
|
|
||||||
var prettyJSON bytes.Buffer
|
|
||||||
if err := json.Indent(&prettyJSON, node.RawDNS.DNSJson, "", " "); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = saveDnsConfig(prettyJSON.Bytes(), dnsPath)
|
|
||||||
} else if len(node.RawDNS.DNSMap) != 0 {
|
|
||||||
dnsConfig := DNSConfig{
|
|
||||||
Servers: []map[string]interface{}{
|
|
||||||
{
|
|
||||||
"tag": "default",
|
|
||||||
"address": "https://8.8.8.8/dns-query",
|
|
||||||
"detour": "direct",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
for id, value := range node.RawDNS.DNSMap {
|
|
||||||
dnsConfig.Servers = append(dnsConfig.Servers,
|
|
||||||
map[string]interface{}{
|
|
||||||
"tag": id,
|
|
||||||
"address": value["address"],
|
|
||||||
"address_resolver": "default",
|
|
||||||
"detour": "direct",
|
|
||||||
},
|
|
||||||
)
|
|
||||||
rule := map[string]interface{}{
|
|
||||||
"server": id,
|
|
||||||
"disable_cache": true,
|
|
||||||
}
|
|
||||||
for _, ruleType := range []string{"domain_suffix", "domain_keyword", "domain_regex", "geosite"} {
|
|
||||||
var domains []string
|
|
||||||
for _, v := range value["domains"].([]string) {
|
|
||||||
split := strings.SplitN(v, ":", 2)
|
|
||||||
prefix := strings.ToLower(split[0])
|
|
||||||
if prefix == ruleType || (prefix == "domain" && ruleType == "domain_suffix") {
|
|
||||||
if len(split) > 1 {
|
|
||||||
domains = append(domains, split[1])
|
|
||||||
}
|
|
||||||
if len(domains) > 0 {
|
|
||||||
rule[ruleType] = domains
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dnsConfig.Rules = append(dnsConfig.Rules, rule)
|
|
||||||
}
|
|
||||||
dnsConfigJSON, err := json.MarshalIndent(dnsConfig, "", " ")
|
|
||||||
if err != nil {
|
|
||||||
log.WithField("err", err).Error("Error marshaling dnsConfig to JSON")
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = saveDnsConfig(dnsConfigJSON, dnsPath)
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func saveDnsConfig(dns []byte, dnsPath string) (err error) {
|
|
||||||
currentData, err := os.ReadFile(dnsPath)
|
|
||||||
if err != nil {
|
|
||||||
log.WithField("err", err).Error("Failed to read SING_DNS_PATH")
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if !bytes.Equal(currentData, dns) {
|
|
||||||
if err = os.Truncate(dnsPath, 0); err != nil {
|
|
||||||
log.WithField("err", err).Error("Failed to clear SING DNS PATH file")
|
|
||||||
}
|
|
||||||
if err = os.WriteFile(dnsPath, dns, 0644); err != nil {
|
|
||||||
log.WithField("err", err).Error("Failed to write DNS to SING DNS PATH file")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
@@ -2,12 +2,10 @@ package sing
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/sagernet/sing-box/common/urltest"
|
|
||||||
|
|
||||||
"github.com/InazumaV/V2bX/common/format"
|
"github.com/InazumaV/V2bX/common/format"
|
||||||
"github.com/InazumaV/V2bX/common/rate"
|
"github.com/InazumaV/V2bX/common/rate"
|
||||||
|
|
||||||
@@ -17,218 +15,111 @@ import (
|
|||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
N "github.com/sagernet/sing/common/network"
|
N "github.com/sagernet/sing/common/network"
|
||||||
"github.com/sagernet/sing/service"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ adapter.ClashServer = (*HookServer)(nil)
|
var _ adapter.ConnectionTracker = (*HookServer)(nil)
|
||||||
|
|
||||||
type HookServer struct {
|
type HookServer struct {
|
||||||
ctx context.Context
|
counter sync.Map
|
||||||
urlTestHistory *urltest.HistoryStorage
|
|
||||||
EnableConnClear bool
|
|
||||||
counter sync.Map
|
|
||||||
connClears sync.Map
|
|
||||||
}
|
|
||||||
|
|
||||||
type ConnClear struct {
|
|
||||||
lock sync.RWMutex
|
|
||||||
conns map[int]io.Closer
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ConnClear) AddConn(cn io.Closer) (key int) {
|
|
||||||
c.lock.Lock()
|
|
||||||
defer c.lock.Unlock()
|
|
||||||
key = len(c.conns)
|
|
||||||
c.conns[key] = cn
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ConnClear) DelConn(key int) {
|
|
||||||
c.lock.Lock()
|
|
||||||
defer c.lock.Unlock()
|
|
||||||
delete(c.conns, key)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ConnClear) ClearConn() {
|
|
||||||
c.lock.Lock()
|
|
||||||
defer c.lock.Unlock()
|
|
||||||
for _, c := range c.conns {
|
|
||||||
c.Close()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HookServer) ModeList() []string {
|
func (h *HookServer) ModeList() []string {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHookServer(ctx context.Context, enableClear bool) *HookServer {
|
func NewHookServer() *HookServer {
|
||||||
server := &HookServer{
|
server := &HookServer{
|
||||||
ctx: ctx,
|
counter: sync.Map{},
|
||||||
EnableConnClear: enableClear,
|
|
||||||
counter: sync.Map{},
|
|
||||||
connClears: sync.Map{},
|
|
||||||
}
|
|
||||||
server.urlTestHistory = service.PtrFromContext[urltest.HistoryStorage](ctx)
|
|
||||||
if server.urlTestHistory == nil {
|
|
||||||
server.urlTestHistory = urltest.NewHistoryStorage()
|
|
||||||
}
|
}
|
||||||
return server
|
return server
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HookServer) Start() error {
|
func (h *HookServer) RoutedConnection(_ context.Context, conn net.Conn, m adapter.InboundContext, _ adapter.Rule, _ adapter.Outbound) net.Conn {
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *HookServer) Close() error {
|
|
||||||
h.urlTestHistory.Close()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *HookServer) PreStart() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *HookServer) RoutedConnection(_ context.Context, conn net.Conn, m adapter.InboundContext, _ adapter.Rule) (net.Conn, adapter.Tracker) {
|
|
||||||
t := &Tracker{}
|
|
||||||
l, err := limiter.GetLimiter(m.Inbound)
|
l, err := limiter.GetLimiter(m.Inbound)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn("get limiter for ", m.Inbound, " error: ", err)
|
log.Warn("get limiter for ", m.Inbound, " error: ", err)
|
||||||
return conn, t
|
return conn
|
||||||
}
|
|
||||||
if l.CheckDomainRule(m.Domain) {
|
|
||||||
conn.Close()
|
|
||||||
log.Error("[", m.Inbound, "] ",
|
|
||||||
"Limited ", m.User, " access to ", m.Domain, " by domain rule")
|
|
||||||
return conn, t
|
|
||||||
}
|
|
||||||
if l.CheckProtocolRule(m.Protocol) {
|
|
||||||
conn.Close()
|
|
||||||
log.Error("[", m.Inbound, "] ",
|
|
||||||
"Limited ", m.User, " use ", m.Domain, " by protocol rule")
|
|
||||||
return conn, t
|
|
||||||
}
|
}
|
||||||
ip := m.Source.Addr.String()
|
ip := m.Source.Addr.String()
|
||||||
if b, r := l.CheckLimit(format.UserTag(m.Inbound, m.User), ip, true, true); r {
|
if b, r := l.CheckLimit(format.UserTag(m.Inbound, m.User), ip, true, true); r {
|
||||||
conn.Close()
|
conn.Close()
|
||||||
log.Error("[", m.Inbound, "] ", "Limited ", m.User, " by ip or conn")
|
log.Error("[", m.Inbound, "] ", "Limited ", m.User, " by ip or conn")
|
||||||
return conn, t
|
return conn
|
||||||
} else if b != nil {
|
} else if b != nil {
|
||||||
conn = rate.NewConnRateLimiter(conn, b)
|
conn = rate.NewConnRateLimiter(conn, b)
|
||||||
}
|
}
|
||||||
t.AddLeave(func() {
|
if l != nil {
|
||||||
l.ConnLimiter.DelConnCount(m.User, ip)
|
destStr := m.Destination.AddrString()
|
||||||
})
|
protocol := m.Destination.Network()
|
||||||
if h.EnableConnClear {
|
if l.CheckDomainRule(destStr) {
|
||||||
var key int
|
log.Error(fmt.Sprintf(
|
||||||
cc := &ConnClear{
|
"User %s access domain %s reject by rule",
|
||||||
conns: map[int]io.Closer{
|
m.User,
|
||||||
0: conn,
|
destStr))
|
||||||
},
|
conn.Close()
|
||||||
|
return conn
|
||||||
}
|
}
|
||||||
if v, ok := h.connClears.LoadOrStore(m.Inbound+m.User, cc); ok {
|
if len(protocol) != 0 {
|
||||||
cc = v.(*ConnClear)
|
if l.CheckProtocolRule(protocol) {
|
||||||
key = cc.AddConn(conn)
|
log.Error(fmt.Sprintf(
|
||||||
|
"User %s access protocol %s reject by rule",
|
||||||
|
m.User,
|
||||||
|
protocol))
|
||||||
|
conn.Close()
|
||||||
|
return conn
|
||||||
|
}
|
||||||
}
|
}
|
||||||
t.AddLeave(func() {
|
|
||||||
cc.DelConn(key)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if c, ok := h.counter.Load(m.Inbound); ok {
|
if c, ok := h.counter.Load(m.Inbound); ok {
|
||||||
return counter.NewConnCounter(conn, c.(*counter.TrafficCounter).GetCounter(m.User)), t
|
return counter.NewConnCounter(conn, c.(*counter.TrafficCounter).GetCounter(m.User))
|
||||||
} else {
|
} else {
|
||||||
c := counter.NewTrafficCounter()
|
c := counter.NewTrafficCounter()
|
||||||
h.counter.Store(m.Inbound, c)
|
h.counter.Store(m.Inbound, c)
|
||||||
return counter.NewConnCounter(conn, c.GetCounter(m.User)), t
|
return counter.NewConnCounter(conn, c.GetCounter(m.User))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *HookServer) RoutedPacketConnection(_ context.Context, conn N.PacketConn, m adapter.InboundContext, _ adapter.Rule) (N.PacketConn, adapter.Tracker) {
|
func (h *HookServer) RoutedPacketConnection(_ context.Context, conn N.PacketConn, m adapter.InboundContext, _ adapter.Rule, _ adapter.Outbound) N.PacketConn {
|
||||||
t := &Tracker{}
|
|
||||||
l, err := limiter.GetLimiter(m.Inbound)
|
l, err := limiter.GetLimiter(m.Inbound)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn("get limiter for ", m.Inbound, " error: ", err)
|
log.Warn("get limiter for ", m.Inbound, " error: ", err)
|
||||||
return conn, t
|
return conn
|
||||||
}
|
|
||||||
if l.CheckDomainRule(m.Domain) {
|
|
||||||
conn.Close()
|
|
||||||
log.Error("[", m.Inbound, "] ",
|
|
||||||
"Limited ", m.User, " access to ", m.Domain, " by domain rule")
|
|
||||||
return conn, t
|
|
||||||
}
|
|
||||||
if l.CheckProtocolRule(m.Protocol) {
|
|
||||||
conn.Close()
|
|
||||||
log.Error("[", m.Inbound, "] ",
|
|
||||||
"Limited ", m.User, " use ", m.Domain, " by protocol rule")
|
|
||||||
return conn, t
|
|
||||||
}
|
}
|
||||||
ip := m.Source.Addr.String()
|
ip := m.Source.Addr.String()
|
||||||
if b, r := l.CheckLimit(format.UserTag(m.Inbound, m.User), ip, false, false); r {
|
if b, r := l.CheckLimit(format.UserTag(m.Inbound, m.User), ip, false, false); r {
|
||||||
conn.Close()
|
conn.Close()
|
||||||
log.Error("[", m.Inbound, "] ", "Limited ", m.User, " by ip or conn")
|
log.Error("[", m.Inbound, "] ", "Limited ", m.User, " by ip or conn")
|
||||||
return conn, t
|
return conn
|
||||||
} else if b != nil {
|
} else if b != nil {
|
||||||
//conn = rate.NewPacketConnCounter(conn, b)
|
//conn = rate.NewPacketConnCounter(conn, b)
|
||||||
}
|
}
|
||||||
if h.EnableConnClear {
|
if l != nil {
|
||||||
var key int
|
destStr := m.Destination.AddrString()
|
||||||
cc := &ConnClear{
|
protocol := m.Destination.Network()
|
||||||
conns: map[int]io.Closer{
|
if l.CheckDomainRule(destStr) {
|
||||||
0: conn,
|
log.Error(fmt.Sprintf(
|
||||||
},
|
"User %s access domain %s reject by rule",
|
||||||
|
m.User,
|
||||||
|
destStr))
|
||||||
|
conn.Close()
|
||||||
|
return conn
|
||||||
}
|
}
|
||||||
if v, ok := h.connClears.LoadOrStore(m.Inbound+m.User, cc); ok {
|
if len(protocol) != 0 {
|
||||||
cc = v.(*ConnClear)
|
if l.CheckProtocolRule(protocol) {
|
||||||
key = cc.AddConn(conn)
|
log.Error(fmt.Sprintf(
|
||||||
|
"User %s access protocol %s reject by rule",
|
||||||
|
m.User,
|
||||||
|
protocol))
|
||||||
|
conn.Close()
|
||||||
|
return conn
|
||||||
|
}
|
||||||
}
|
}
|
||||||
t.AddLeave(func() {
|
|
||||||
cc.DelConn(key)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
if c, ok := h.counter.Load(m.Inbound); ok {
|
if c, ok := h.counter.Load(m.Inbound); ok {
|
||||||
return counter.NewPacketConnCounter(conn, c.(*counter.TrafficCounter).GetCounter(m.User)), t
|
return counter.NewPacketConnCounter(conn, c.(*counter.TrafficCounter).GetCounter(m.User))
|
||||||
} else {
|
} else {
|
||||||
c := counter.NewTrafficCounter()
|
c := counter.NewTrafficCounter()
|
||||||
h.counter.Store(m.Inbound, c)
|
h.counter.Store(m.Inbound, c)
|
||||||
return counter.NewPacketConnCounter(conn, c.GetCounter(m.User)), t
|
return counter.NewPacketConnCounter(conn, c.GetCounter(m.User))
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// not need
|
|
||||||
|
|
||||||
func (h *HookServer) Mode() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
func (h *HookServer) StoreSelected() bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
func (h *HookServer) CacheFile() adapter.CacheFile {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
func (h *HookServer) HistoryStorage() *urltest.HistoryStorage {
|
|
||||||
return h.urlTestHistory
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *HookServer) StoreFakeIP() bool {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
func (h *HookServer) ClearConn(inbound string, user string) {
|
|
||||||
if v, ok := h.connClears.Load(inbound + user); ok {
|
|
||||||
v.(*ConnClear).ClearConn()
|
|
||||||
h.connClears.Delete(inbound + user)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type Tracker struct {
|
|
||||||
l []func()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *Tracker) AddLeave(f func()) {
|
|
||||||
t.l = append(t.l, f)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *Tracker) Leave() {
|
|
||||||
for i := range t.l {
|
|
||||||
t.l[i]()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import (
|
|||||||
"github.com/InazumaV/V2bX/api/panel"
|
"github.com/InazumaV/V2bX/api/panel"
|
||||||
"github.com/InazumaV/V2bX/conf"
|
"github.com/InazumaV/V2bX/conf"
|
||||||
"github.com/goccy/go-json"
|
"github.com/goccy/go-json"
|
||||||
"github.com/sagernet/sing-box/inbound"
|
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
F "github.com/sagernet/sing/common/format"
|
F "github.com/sagernet/sing/common/format"
|
||||||
|
"github.com/sagernet/sing/common/json/badoption"
|
||||||
)
|
)
|
||||||
|
|
||||||
type HttpNetworkConfig struct {
|
type HttpNetworkConfig struct {
|
||||||
@@ -59,16 +59,28 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
domainStrategy = c.SingOptions.DomainStrategy
|
domainStrategy = c.SingOptions.DomainStrategy
|
||||||
}
|
}
|
||||||
listen := option.ListenOptions{
|
listen := option.ListenOptions{
|
||||||
Listen: (*option.ListenAddress)(&addr),
|
Listen: (*badoption.Addr)(&addr),
|
||||||
ListenPort: uint16(info.Common.ServerPort),
|
ListenPort: uint16(info.Common.ServerPort),
|
||||||
ProxyProtocol: c.SingOptions.EnableProxyProtocol,
|
TCPFastOpen: c.SingOptions.TCPFastOpen,
|
||||||
TCPFastOpen: c.SingOptions.TCPFastOpen,
|
|
||||||
InboundOptions: option.InboundOptions{
|
InboundOptions: option.InboundOptions{
|
||||||
SniffEnabled: c.SingOptions.SniffEnabled,
|
SniffEnabled: c.SingOptions.SniffEnabled,
|
||||||
SniffOverrideDestination: c.SingOptions.SniffOverrideDestination,
|
SniffOverrideDestination: c.SingOptions.SniffOverrideDestination,
|
||||||
DomainStrategy: domainStrategy,
|
DomainStrategy: domainStrategy,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
var multiplex *option.InboundMultiplexOptions
|
||||||
|
if c.SingOptions.Multiplex != nil {
|
||||||
|
multiplexOption := option.InboundMultiplexOptions{
|
||||||
|
Enabled: c.SingOptions.Multiplex.Enabled,
|
||||||
|
Padding: c.SingOptions.Multiplex.Padding,
|
||||||
|
Brutal: &option.BrutalOptions{
|
||||||
|
Enabled: c.SingOptions.Multiplex.Brutal.Enabled,
|
||||||
|
UpMbps: c.SingOptions.Multiplex.Brutal.UpMbps,
|
||||||
|
DownMbps: c.SingOptions.Multiplex.Brutal.DownMbps,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
multiplex = &multiplexOption
|
||||||
|
}
|
||||||
var tls option.InboundTLSOptions
|
var tls option.InboundTLSOptions
|
||||||
switch info.Security {
|
switch info.Security {
|
||||||
case panel.Tls:
|
case panel.Tls:
|
||||||
@@ -107,7 +119,7 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
ServerPort: uint16(port),
|
ServerPort: uint16(port),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
MaxTimeDifference: option.Duration(mtd),
|
MaxTimeDifference: badoption.Duration(mtd),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in := option.Inbound{
|
in := option.Inbound{
|
||||||
@@ -150,7 +162,7 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
var (
|
var (
|
||||||
path string
|
path string
|
||||||
ed int
|
ed int
|
||||||
headers map[string]option.Listable[string]
|
headers map[string]badoption.Listable[string]
|
||||||
)
|
)
|
||||||
if len(n.NetworkSettings) != 0 {
|
if len(n.NetworkSettings) != 0 {
|
||||||
network := WsNetworkConfig{}
|
network := WsNetworkConfig{}
|
||||||
@@ -165,9 +177,9 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
}
|
}
|
||||||
path = u.Path
|
path = u.Path
|
||||||
ed, _ = strconv.Atoi(u.Query().Get("ed"))
|
ed, _ = strconv.Atoi(u.Query().Get("ed"))
|
||||||
headers = make(map[string]option.Listable[string], len(network.Headers))
|
headers = make(map[string]badoption.Listable[string], len(network.Headers))
|
||||||
for k, v := range network.Headers {
|
for k, v := range network.Headers {
|
||||||
headers[k] = option.Listable[string]{
|
headers[k] = badoption.Listable[string]{
|
||||||
v,
|
v,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,21 +216,23 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
}
|
}
|
||||||
if info.Type == "vless" {
|
if info.Type == "vless" {
|
||||||
in.Type = "vless"
|
in.Type = "vless"
|
||||||
in.VLESSOptions = option.VLESSInboundOptions{
|
in.Options = &option.VLESSInboundOptions{
|
||||||
ListenOptions: listen,
|
ListenOptions: listen,
|
||||||
InboundTLSOptionsContainer: option.InboundTLSOptionsContainer{
|
InboundTLSOptionsContainer: option.InboundTLSOptionsContainer{
|
||||||
TLS: &tls,
|
TLS: &tls,
|
||||||
},
|
},
|
||||||
Transport: &t,
|
Transport: &t,
|
||||||
|
Multiplex: multiplex,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
in.Type = "vmess"
|
in.Type = "vmess"
|
||||||
in.VMessOptions = option.VMessInboundOptions{
|
in.Options = &option.VMessInboundOptions{
|
||||||
ListenOptions: listen,
|
ListenOptions: listen,
|
||||||
InboundTLSOptionsContainer: option.InboundTLSOptionsContainer{
|
InboundTLSOptionsContainer: option.InboundTLSOptionsContainer{
|
||||||
TLS: &tls,
|
TLS: &tls,
|
||||||
},
|
},
|
||||||
Transport: &t,
|
Transport: &t,
|
||||||
|
Multiplex: multiplex,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "shadowsocks":
|
case "shadowsocks":
|
||||||
@@ -233,20 +247,22 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
default:
|
default:
|
||||||
keyLength = 16
|
keyLength = 16
|
||||||
}
|
}
|
||||||
in.ShadowsocksOptions = option.ShadowsocksInboundOptions{
|
ssoption := &option.ShadowsocksInboundOptions{
|
||||||
ListenOptions: listen,
|
ListenOptions: listen,
|
||||||
Method: n.Cipher,
|
Method: n.Cipher,
|
||||||
|
Multiplex: multiplex,
|
||||||
}
|
}
|
||||||
p := make([]byte, keyLength)
|
p := make([]byte, keyLength)
|
||||||
_, _ = rand.Read(p)
|
_, _ = rand.Read(p)
|
||||||
randomPasswd := string(p)
|
randomPasswd := string(p)
|
||||||
if strings.Contains(n.Cipher, "2022") {
|
if strings.Contains(n.Cipher, "2022") {
|
||||||
in.ShadowsocksOptions.Password = n.ServerKey
|
ssoption.Password = n.ServerKey
|
||||||
randomPasswd = base64.StdEncoding.EncodeToString([]byte(randomPasswd))
|
randomPasswd = base64.StdEncoding.EncodeToString([]byte(randomPasswd))
|
||||||
}
|
}
|
||||||
in.ShadowsocksOptions.Users = []option.ShadowsocksUser{{
|
ssoption.Users = []option.ShadowsocksUser{{
|
||||||
Password: randomPasswd,
|
Password: randomPasswd,
|
||||||
}}
|
}}
|
||||||
|
in.Options = ssoption
|
||||||
case "trojan":
|
case "trojan":
|
||||||
n := info.Trojan
|
n := info.Trojan
|
||||||
t := option.V2RayTransportOptions{
|
t := option.V2RayTransportOptions{
|
||||||
@@ -259,7 +275,7 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
var (
|
var (
|
||||||
path string
|
path string
|
||||||
ed int
|
ed int
|
||||||
headers map[string]option.Listable[string]
|
headers map[string]badoption.Listable[string]
|
||||||
)
|
)
|
||||||
if len(n.NetworkSettings) != 0 {
|
if len(n.NetworkSettings) != 0 {
|
||||||
network := WsNetworkConfig{}
|
network := WsNetworkConfig{}
|
||||||
@@ -274,9 +290,9 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
}
|
}
|
||||||
path = u.Path
|
path = u.Path
|
||||||
ed, _ = strconv.Atoi(u.Query().Get("ed"))
|
ed, _ = strconv.Atoi(u.Query().Get("ed"))
|
||||||
headers = make(map[string]option.Listable[string], len(network.Headers))
|
headers = make(map[string]badoption.Listable[string], len(network.Headers))
|
||||||
for k, v := range network.Headers {
|
for k, v := range network.Headers {
|
||||||
headers[k] = option.Listable[string]{
|
headers[k] = badoption.Listable[string]{
|
||||||
v,
|
v,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -302,19 +318,20 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
t.Type = ""
|
t.Type = ""
|
||||||
}
|
}
|
||||||
in.Type = "trojan"
|
in.Type = "trojan"
|
||||||
in.TrojanOptions = option.TrojanInboundOptions{
|
trojanoption := &option.TrojanInboundOptions{
|
||||||
ListenOptions: listen,
|
ListenOptions: listen,
|
||||||
InboundTLSOptionsContainer: option.InboundTLSOptionsContainer{
|
InboundTLSOptionsContainer: option.InboundTLSOptionsContainer{
|
||||||
TLS: &tls,
|
TLS: &tls,
|
||||||
},
|
},
|
||||||
Transport: &t,
|
Transport: &t,
|
||||||
|
Multiplex: multiplex,
|
||||||
}
|
}
|
||||||
if c.SingOptions.FallBackConfigs != nil {
|
if c.SingOptions.FallBackConfigs != nil {
|
||||||
// fallback handling
|
// fallback handling
|
||||||
fallback := c.SingOptions.FallBackConfigs.FallBack
|
fallback := c.SingOptions.FallBackConfigs.FallBack
|
||||||
fallbackPort, err := strconv.Atoi(fallback.ServerPort)
|
fallbackPort, err := strconv.Atoi(fallback.ServerPort)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
in.TrojanOptions.Fallback = &option.ServerOptions{
|
trojanoption.Fallback = &option.ServerOptions{
|
||||||
Server: fallback.Server,
|
Server: fallback.Server,
|
||||||
ServerPort: uint16(fallbackPort),
|
ServerPort: uint16(fallbackPort),
|
||||||
}
|
}
|
||||||
@@ -322,12 +339,13 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
fallbackForALPNMap := c.SingOptions.FallBackConfigs.FallBackForALPN
|
fallbackForALPNMap := c.SingOptions.FallBackConfigs.FallBackForALPN
|
||||||
fallbackForALPN := make(map[string]*option.ServerOptions, len(fallbackForALPNMap))
|
fallbackForALPN := make(map[string]*option.ServerOptions, len(fallbackForALPNMap))
|
||||||
if err := processFallback(c, fallbackForALPN); err == nil {
|
if err := processFallback(c, fallbackForALPN); err == nil {
|
||||||
in.TrojanOptions.FallbackForALPN = fallbackForALPN
|
trojanoption.FallbackForALPN = fallbackForALPN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
in.Options = trojanoption
|
||||||
case "hysteria":
|
case "hysteria":
|
||||||
in.Type = "hysteria"
|
in.Type = "hysteria"
|
||||||
in.HysteriaOptions = option.HysteriaInboundOptions{
|
in.Options = &option.HysteriaInboundOptions{
|
||||||
ListenOptions: listen,
|
ListenOptions: listen,
|
||||||
UpMbps: info.Hysteria.UpMbps,
|
UpMbps: info.Hysteria.UpMbps,
|
||||||
DownMbps: info.Hysteria.DownMbps,
|
DownMbps: info.Hysteria.DownMbps,
|
||||||
@@ -350,11 +368,12 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
Password: info.Hysteria2.ObfsType,
|
Password: info.Hysteria2.ObfsType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in.Hysteria2Options = option.Hysteria2InboundOptions{
|
in.Options = &option.Hysteria2InboundOptions{
|
||||||
ListenOptions: listen,
|
ListenOptions: listen,
|
||||||
UpMbps: info.Hysteria2.UpMbps,
|
UpMbps: info.Hysteria2.UpMbps,
|
||||||
DownMbps: info.Hysteria2.DownMbps,
|
DownMbps: info.Hysteria2.DownMbps,
|
||||||
Obfs: obfs,
|
IgnoreClientBandwidth: info.Hysteria2.Ignore_Client_Bandwidth,
|
||||||
|
Obfs: obfs,
|
||||||
InboundTLSOptionsContainer: option.InboundTLSOptionsContainer{
|
InboundTLSOptionsContainer: option.InboundTLSOptionsContainer{
|
||||||
TLS: &tls,
|
TLS: &tls,
|
||||||
},
|
},
|
||||||
@@ -364,32 +383,20 @@ func getInboundOptions(tag string, info *panel.NodeInfo, c *conf.Options) (optio
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *Sing) AddNode(tag string, info *panel.NodeInfo, config *conf.Options) error {
|
func (b *Sing) AddNode(tag string, info *panel.NodeInfo, config *conf.Options) error {
|
||||||
err := updateDNSConfig(info)
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("build dns error: %s", err)
|
|
||||||
}
|
|
||||||
c, err := getInboundOptions(tag, info, config)
|
c, err := getInboundOptions(tag, info, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
in := b.box.Inbound()
|
||||||
in, err := inbound.New(
|
err = in.Create(
|
||||||
b.ctx,
|
b.ctx,
|
||||||
b.box.Router(),
|
b.box.Router(),
|
||||||
b.logFactory.NewLogger(F.ToString("inbound/", c.Type, "[", tag, "]")),
|
b.logFactory.NewLogger(F.ToString("inbound/", c.Type, "[", tag, "]")),
|
||||||
tag,
|
tag,
|
||||||
c,
|
c.Type,
|
||||||
nil,
|
c.Options,
|
||||||
)
|
)
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("init inbound error: %s", err)
|
|
||||||
}
|
|
||||||
err = in.Start()
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("start inbound error: %s", err)
|
|
||||||
}
|
|
||||||
b.inbounds[tag] = in
|
|
||||||
err = b.router.AddInbound(in)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("add inbound error: %s", err)
|
return fmt.Errorf("add inbound error: %s", err)
|
||||||
}
|
}
|
||||||
@@ -397,11 +404,8 @@ func (b *Sing) AddNode(tag string, info *panel.NodeInfo, config *conf.Options) e
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *Sing) DelNode(tag string) error {
|
func (b *Sing) DelNode(tag string) error {
|
||||||
err := b.inbounds[tag].Close()
|
in := b.box.Inbound()
|
||||||
if err != nil {
|
err := in.Remove(tag)
|
||||||
return fmt.Errorf("close inbound error: %s", err)
|
|
||||||
}
|
|
||||||
err = b.router.DelInbound(tag)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("delete inbound error: %s", err)
|
return fmt.Errorf("delete inbound error: %s", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,14 +5,15 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/sagernet/sing-box/include"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
|
|
||||||
"github.com/InazumaV/V2bX/conf"
|
"github.com/InazumaV/V2bX/conf"
|
||||||
vCore "github.com/InazumaV/V2bX/core"
|
vCore "github.com/InazumaV/V2bX/core"
|
||||||
"github.com/goccy/go-json"
|
|
||||||
box "github.com/sagernet/sing-box"
|
box "github.com/sagernet/sing-box"
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
|
"github.com/sagernet/sing/common/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ vCore.Core = (*Sing)(nil)
|
var _ vCore.Core = (*Sing)(nil)
|
||||||
@@ -28,7 +29,6 @@ type Sing struct {
|
|||||||
hookServer *HookServer
|
hookServer *HookServer
|
||||||
router adapter.Router
|
router adapter.Router
|
||||||
logFactory log.Factory
|
logFactory log.Factory
|
||||||
inbounds map[string]adapter.Inbound
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -36,13 +36,15 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func New(c *conf.CoreConfig) (vCore.Core, error) {
|
func New(c *conf.CoreConfig) (vCore.Core, error) {
|
||||||
|
ctx := context.Background()
|
||||||
|
ctx = box.Context(ctx, include.InboundRegistry(), include.OutboundRegistry(), include.EndpointRegistry(), include.DNSTransportRegistry())
|
||||||
options := option.Options{}
|
options := option.Options{}
|
||||||
if len(c.SingConfig.OriginalPath) != 0 {
|
if len(c.SingConfig.OriginalPath) != 0 {
|
||||||
data, err := os.ReadFile(c.SingConfig.OriginalPath)
|
data, err := os.ReadFile(c.SingConfig.OriginalPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("read original config error: %s", err)
|
return nil, fmt.Errorf("read original config error: %s", err)
|
||||||
}
|
}
|
||||||
err = json.Unmarshal(data, &options)
|
options, err = json.UnmarshalExtendedContext[option.Options](ctx, data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("unmarshal original config error: %s", err)
|
return nil, fmt.Errorf("unmarshal original config error: %s", err)
|
||||||
}
|
}
|
||||||
@@ -63,21 +65,20 @@ func New(c *conf.CoreConfig) (vCore.Core, error) {
|
|||||||
}
|
}
|
||||||
os.Setenv("SING_DNS_PATH", "")
|
os.Setenv("SING_DNS_PATH", "")
|
||||||
b, err := box.New(box.Options{
|
b, err := box.New(box.Options{
|
||||||
Context: context.Background(),
|
Context: ctx,
|
||||||
Options: options,
|
Options: options,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
hs := NewHookServer(b.Router().GetCtx(), c.SingConfig.EnableConnClear)
|
hs := NewHookServer()
|
||||||
b.Router().SetClashServer(hs)
|
b.Router().SetTracker(hs)
|
||||||
return &Sing{
|
return &Sing{
|
||||||
ctx: b.Router().GetCtx(),
|
ctx: b.Router().GetCtx(),
|
||||||
box: b,
|
box: b,
|
||||||
hookServer: hs,
|
hookServer: hs,
|
||||||
router: b.Router(),
|
router: b.Router(),
|
||||||
logFactory: b.LogFactory(),
|
logFactory: b.LogFactory(),
|
||||||
inbounds: make(map[string]adapter.Inbound),
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,33 +7,40 @@ import (
|
|||||||
"github.com/InazumaV/V2bX/api/panel"
|
"github.com/InazumaV/V2bX/api/panel"
|
||||||
"github.com/InazumaV/V2bX/common/counter"
|
"github.com/InazumaV/V2bX/common/counter"
|
||||||
"github.com/InazumaV/V2bX/core"
|
"github.com/InazumaV/V2bX/core"
|
||||||
"github.com/sagernet/sing-box/inbound"
|
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
|
"github.com/sagernet/sing-box/protocol/hysteria"
|
||||||
|
"github.com/sagernet/sing-box/protocol/hysteria2"
|
||||||
|
"github.com/sagernet/sing-box/protocol/shadowsocks"
|
||||||
|
"github.com/sagernet/sing-box/protocol/trojan"
|
||||||
|
"github.com/sagernet/sing-box/protocol/vless"
|
||||||
|
"github.com/sagernet/sing-box/protocol/vmess"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (b *Sing) AddUsers(p *core.AddUsersParams) (added int, err error) {
|
func (b *Sing) AddUsers(p *core.AddUsersParams) (added int, err error) {
|
||||||
|
in, found := b.box.Inbound().Get(p.Tag)
|
||||||
|
if !found {
|
||||||
|
return 0, errors.New("the inbound not found")
|
||||||
|
}
|
||||||
switch p.NodeInfo.Type {
|
switch p.NodeInfo.Type {
|
||||||
case "vmess", "vless":
|
case "vless":
|
||||||
if p.NodeInfo.Type == "vless" {
|
us := make([]option.VLESSUser, len(p.Users))
|
||||||
us := make([]option.VLESSUser, len(p.Users))
|
for i := range p.Users {
|
||||||
for i := range p.Users {
|
us[i] = option.VLESSUser{
|
||||||
us[i] = option.VLESSUser{
|
Name: p.Users[i].Uuid,
|
||||||
Name: p.Users[i].Uuid,
|
Flow: p.VAllss.Flow,
|
||||||
Flow: p.VAllss.Flow,
|
UUID: p.Users[i].Uuid,
|
||||||
UUID: p.Users[i].Uuid,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
err = b.inbounds[p.Tag].(*inbound.VLESS).AddUsers(us)
|
|
||||||
} else {
|
|
||||||
us := make([]option.VMessUser, len(p.Users))
|
|
||||||
for i := range p.Users {
|
|
||||||
us[i] = option.VMessUser{
|
|
||||||
Name: p.Users[i].Uuid,
|
|
||||||
UUID: p.Users[i].Uuid,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
err = b.inbounds[p.Tag].(*inbound.VMess).AddUsers(us)
|
|
||||||
}
|
}
|
||||||
|
err = in.(*vless.Inbound).AddUsers(us)
|
||||||
|
case "vmess":
|
||||||
|
us := make([]option.VMessUser, len(p.Users))
|
||||||
|
for i := range p.Users {
|
||||||
|
us[i] = option.VMessUser{
|
||||||
|
Name: p.Users[i].Uuid,
|
||||||
|
UUID: p.Users[i].Uuid,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = in.(*vmess.Inbound).AddUsers(us)
|
||||||
case "shadowsocks":
|
case "shadowsocks":
|
||||||
us := make([]option.ShadowsocksUser, len(p.Users))
|
us := make([]option.ShadowsocksUser, len(p.Users))
|
||||||
for i := range p.Users {
|
for i := range p.Users {
|
||||||
@@ -49,7 +56,7 @@ func (b *Sing) AddUsers(p *core.AddUsersParams) (added int, err error) {
|
|||||||
Password: password,
|
Password: password,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = b.inbounds[p.Tag].(*inbound.ShadowsocksMulti).AddUsers(us)
|
err = in.(*shadowsocks.MultiInbound).AddUsers(us)
|
||||||
case "trojan":
|
case "trojan":
|
||||||
us := make([]option.TrojanUser, len(p.Users))
|
us := make([]option.TrojanUser, len(p.Users))
|
||||||
for i := range p.Users {
|
for i := range p.Users {
|
||||||
@@ -58,7 +65,7 @@ func (b *Sing) AddUsers(p *core.AddUsersParams) (added int, err error) {
|
|||||||
Password: p.Users[i].Uuid,
|
Password: p.Users[i].Uuid,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = b.inbounds[p.Tag].(*inbound.Trojan).AddUsers(us)
|
err = in.(*trojan.Inbound).AddUsers(us)
|
||||||
case "hysteria":
|
case "hysteria":
|
||||||
us := make([]option.HysteriaUser, len(p.Users))
|
us := make([]option.HysteriaUser, len(p.Users))
|
||||||
for i := range p.Users {
|
for i := range p.Users {
|
||||||
@@ -67,7 +74,7 @@ func (b *Sing) AddUsers(p *core.AddUsersParams) (added int, err error) {
|
|||||||
AuthString: p.Users[i].Uuid,
|
AuthString: p.Users[i].Uuid,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
err = b.inbounds[p.Tag].(*inbound.Hysteria).AddUsers(us)
|
err = in.(*hysteria.Inbound).AddUsers(us)
|
||||||
case "hysteria2":
|
case "hysteria2":
|
||||||
us := make([]option.Hysteria2User, len(p.Users))
|
us := make([]option.Hysteria2User, len(p.Users))
|
||||||
id := make([]int, len(p.Users))
|
id := make([]int, len(p.Users))
|
||||||
@@ -78,7 +85,7 @@ func (b *Sing) AddUsers(p *core.AddUsersParams) (added int, err error) {
|
|||||||
}
|
}
|
||||||
id[i] = p.Users[i].Id
|
id[i] = p.Users[i].Id
|
||||||
}
|
}
|
||||||
err = b.inbounds[p.Tag].(*inbound.Hysteria2).AddUsers(us, id)
|
err = in.(*hysteria2.Inbound).AddUsers(us, id)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
@@ -103,29 +110,28 @@ type UserDeleter interface {
|
|||||||
DelUsers(uuid []string) error
|
DelUsers(uuid []string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Sing) DelUsers(users []panel.UserInfo, tag string) error {
|
func (b *Sing) DelUsers(users []panel.UserInfo, tag string, info *panel.NodeInfo) error {
|
||||||
var del UserDeleter
|
var del UserDeleter
|
||||||
if i, ok := b.inbounds[tag]; ok {
|
if i, found := b.box.Inbound().Get(tag); found {
|
||||||
switch i.Type() {
|
switch info.Type {
|
||||||
case "vmess":
|
case "vmess":
|
||||||
del = i.(*inbound.VMess)
|
del = i.(*vmess.Inbound)
|
||||||
case "vless":
|
case "vless":
|
||||||
del = i.(*inbound.VLESS)
|
del = i.(*vless.Inbound)
|
||||||
case "shadowsocks":
|
case "shadowsocks":
|
||||||
del = i.(*inbound.ShadowsocksMulti)
|
del = i.(*shadowsocks.MultiInbound)
|
||||||
case "trojan":
|
case "trojan":
|
||||||
del = i.(*inbound.Trojan)
|
del = i.(*trojan.Inbound)
|
||||||
case "hysteria":
|
case "hysteria":
|
||||||
del = i.(*inbound.Hysteria)
|
del = i.(*hysteria.Inbound)
|
||||||
case "hysteria2":
|
case "hysteria2":
|
||||||
del = i.(*inbound.Hysteria2)
|
del = i.(*hysteria2.Inbound)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return errors.New("the inbound not found")
|
return errors.New("the inbound not found")
|
||||||
}
|
}
|
||||||
uuids := make([]string, len(users))
|
uuids := make([]string, len(users))
|
||||||
for i := range users {
|
for i := range users {
|
||||||
b.hookServer.ClearConn(tag, users[i].Uuid)
|
|
||||||
uuids[i] = users[i].Uuid
|
uuids[i] = users[i].Uuid
|
||||||
}
|
}
|
||||||
err := del.DelUsers(uuids)
|
err := del.DelUsers(uuids)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.31.0
|
// protoc-gen-go v1.35.1
|
||||||
// protoc v4.23.4
|
// protoc v3.21.12
|
||||||
// source: config.proto
|
// source: config.proto
|
||||||
|
|
||||||
package dispatcher
|
package dispatcher
|
||||||
@@ -28,11 +28,9 @@ type SessionConfig struct {
|
|||||||
|
|
||||||
func (x *SessionConfig) Reset() {
|
func (x *SessionConfig) Reset() {
|
||||||
*x = SessionConfig{}
|
*x = SessionConfig{}
|
||||||
if protoimpl.UnsafeEnabled {
|
mi := &file_config_proto_msgTypes[0]
|
||||||
mi := &file_config_proto_msgTypes[0]
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms.StoreMessageInfo(mi)
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *SessionConfig) String() string {
|
func (x *SessionConfig) String() string {
|
||||||
@@ -43,7 +41,7 @@ func (*SessionConfig) ProtoMessage() {}
|
|||||||
|
|
||||||
func (x *SessionConfig) ProtoReflect() protoreflect.Message {
|
func (x *SessionConfig) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_config_proto_msgTypes[0]
|
mi := &file_config_proto_msgTypes[0]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
@@ -68,11 +66,9 @@ type Config struct {
|
|||||||
|
|
||||||
func (x *Config) Reset() {
|
func (x *Config) Reset() {
|
||||||
*x = Config{}
|
*x = Config{}
|
||||||
if protoimpl.UnsafeEnabled {
|
mi := &file_config_proto_msgTypes[1]
|
||||||
mi := &file_config_proto_msgTypes[1]
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms.StoreMessageInfo(mi)
|
||||||
ms.StoreMessageInfo(mi)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Config) String() string {
|
func (x *Config) String() string {
|
||||||
@@ -83,7 +79,7 @@ func (*Config) ProtoMessage() {}
|
|||||||
|
|
||||||
func (x *Config) ProtoReflect() protoreflect.Message {
|
func (x *Config) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_config_proto_msgTypes[1]
|
mi := &file_config_proto_msgTypes[1]
|
||||||
if protoimpl.UnsafeEnabled && x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
@@ -140,7 +136,7 @@ func file_config_proto_rawDescGZIP() []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var file_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
var file_config_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||||
var file_config_proto_goTypes = []interface{}{
|
var file_config_proto_goTypes = []any{
|
||||||
(*SessionConfig)(nil), // 0: v2bx.core.app.dispatcher.SessionConfig
|
(*SessionConfig)(nil), // 0: v2bx.core.app.dispatcher.SessionConfig
|
||||||
(*Config)(nil), // 1: v2bx.core.app.dispatcher.Config
|
(*Config)(nil), // 1: v2bx.core.app.dispatcher.Config
|
||||||
}
|
}
|
||||||
@@ -158,32 +154,6 @@ func file_config_proto_init() {
|
|||||||
if File_config_proto != nil {
|
if File_config_proto != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !protoimpl.UnsafeEnabled {
|
|
||||||
file_config_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
|
||||||
switch v := v.(*SessionConfig); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
file_config_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
|
||||||
switch v := v.(*Config); i {
|
|
||||||
case 0:
|
|
||||||
return &v.state
|
|
||||||
case 1:
|
|
||||||
return &v.sizeCache
|
|
||||||
case 2:
|
|
||||||
return &v.unknownFields
|
|
||||||
default:
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
File: protoimpl.DescBuilder{
|
File: protoimpl.DescBuilder{
|
||||||
|
|||||||
@@ -45,8 +45,14 @@ func (r *cachedReader) Cache(b *buf.Buffer) {
|
|||||||
if !mb.IsEmpty() {
|
if !mb.IsEmpty() {
|
||||||
r.cache, _ = buf.MergeMulti(r.cache, mb)
|
r.cache, _ = buf.MergeMulti(r.cache, mb)
|
||||||
}
|
}
|
||||||
b.Clear()
|
cacheLen := r.cache.Len()
|
||||||
rawBytes := b.Extend(buf.Size)
|
if cacheLen <= b.Cap() {
|
||||||
|
b.Clear()
|
||||||
|
} else {
|
||||||
|
b.Release()
|
||||||
|
*b = *buf.NewWithSize(cacheLen)
|
||||||
|
}
|
||||||
|
rawBytes := b.Extend(cacheLen)
|
||||||
n := r.cache.Copy(rawBytes)
|
n := r.cache.Copy(rawBytes)
|
||||||
b.Resize(0, int32(n))
|
b.Resize(0, int32(n))
|
||||||
r.Unlock()
|
r.Unlock()
|
||||||
@@ -106,7 +112,7 @@ func init() {
|
|||||||
common.Must(common.RegisterConfig((*Config)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {
|
common.Must(common.RegisterConfig((*Config)(nil), func(ctx context.Context, config interface{}) (interface{}, error) {
|
||||||
d := new(DefaultDispatcher)
|
d := new(DefaultDispatcher)
|
||||||
if err := core.RequireFeatures(ctx, func(om outbound.Manager, router routing.Router, pm policy.Manager, sm stats.Manager, dc dns.Client) error {
|
if err := core.RequireFeatures(ctx, func(om outbound.Manager, router routing.Router, pm policy.Manager, sm stats.Manager, dc dns.Client) error {
|
||||||
core.RequireFeatures(ctx, func(fdns dns.FakeDNSEngine) {
|
core.OptionalFeatures(ctx, func(fdns dns.FakeDNSEngine) {
|
||||||
d.fdns = fdns
|
d.fdns = fdns
|
||||||
})
|
})
|
||||||
return d.Init(config.(*Config), om, router, pm, sm, dc)
|
return d.Init(config.(*Config), om, router, pm, sm, dc)
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import (
|
|||||||
_ "github.com/xtls/xray-core/proxy/http"
|
_ "github.com/xtls/xray-core/proxy/http"
|
||||||
_ "github.com/xtls/xray-core/proxy/loopback"
|
_ "github.com/xtls/xray-core/proxy/loopback"
|
||||||
_ "github.com/xtls/xray-core/proxy/shadowsocks"
|
_ "github.com/xtls/xray-core/proxy/shadowsocks"
|
||||||
|
_ "github.com/xtls/xray-core/proxy/shadowsocks_2022"
|
||||||
_ "github.com/xtls/xray-core/proxy/socks"
|
_ "github.com/xtls/xray-core/proxy/socks"
|
||||||
_ "github.com/xtls/xray-core/proxy/trojan"
|
_ "github.com/xtls/xray-core/proxy/trojan"
|
||||||
_ "github.com/xtls/xray-core/proxy/vless/inbound"
|
_ "github.com/xtls/xray-core/proxy/vless/inbound"
|
||||||
@@ -51,13 +52,10 @@ import (
|
|||||||
//_ "github.com/xtls/xray-core/proxy/wireguard"
|
//_ "github.com/xtls/xray-core/proxy/wireguard"
|
||||||
|
|
||||||
// Transports
|
// Transports
|
||||||
//_ "github.com/xtls/xray-core/transport/internet/domainsocket"
|
|
||||||
_ "github.com/xtls/xray-core/transport/internet/grpc"
|
_ "github.com/xtls/xray-core/transport/internet/grpc"
|
||||||
_ "github.com/xtls/xray-core/transport/internet/http"
|
_ "github.com/xtls/xray-core/transport/internet/kcp"
|
||||||
|
|
||||||
//_ "github.com/xtls/xray-core/transport/internet/kcp"
|
|
||||||
//_ "github.com/xtls/xray-core/transport/internet/quic"
|
|
||||||
_ "github.com/xtls/xray-core/transport/internet/reality"
|
_ "github.com/xtls/xray-core/transport/internet/reality"
|
||||||
|
_ "github.com/xtls/xray-core/transport/internet/splithttp"
|
||||||
_ "github.com/xtls/xray-core/transport/internet/tcp"
|
_ "github.com/xtls/xray-core/transport/internet/tcp"
|
||||||
_ "github.com/xtls/xray-core/transport/internet/tls"
|
_ "github.com/xtls/xray-core/transport/internet/tls"
|
||||||
_ "github.com/xtls/xray-core/transport/internet/udp"
|
_ "github.com/xtls/xray-core/transport/internet/udp"
|
||||||
@@ -70,5 +68,5 @@ import (
|
|||||||
_ "github.com/xtls/xray-core/transport/internet/headers/tls"
|
_ "github.com/xtls/xray-core/transport/internet/headers/tls"
|
||||||
_ "github.com/xtls/xray-core/transport/internet/headers/utp"
|
_ "github.com/xtls/xray-core/transport/internet/headers/utp"
|
||||||
_ "github.com/xtls/xray-core/transport/internet/headers/wechat"
|
_ "github.com/xtls/xray-core/transport/internet/headers/wechat"
|
||||||
//_ "github.com/xtls/xray-core/transport/internet/headers/wireguard"
|
_ "github.com/xtls/xray-core/transport/internet/headers/wireguard"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -204,12 +204,7 @@ func buildV2ray(config *conf.Options, nodeInfo *panel.NodeInfo, inbound *coreCon
|
|||||||
return fmt.Errorf("unmarshal ws settings error: %s", err)
|
return fmt.Errorf("unmarshal ws settings error: %s", err)
|
||||||
}
|
}
|
||||||
case "grpc":
|
case "grpc":
|
||||||
err := json.Unmarshal(v.NetworkSettings, &inbound.StreamSetting.GRPCConfig)
|
err := json.Unmarshal(v.NetworkSettings, &inbound.StreamSetting.GRPCSettings)
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("unmarshal grpc settings error: %s", err)
|
|
||||||
}
|
|
||||||
case "http":
|
|
||||||
err := json.Unmarshal(v.NetworkSettings, &inbound.StreamSetting.HTTPSettings)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unmarshal grpc settings error: %s", err)
|
return fmt.Errorf("unmarshal grpc settings error: %s", err)
|
||||||
}
|
}
|
||||||
@@ -218,10 +213,10 @@ func buildV2ray(config *conf.Options, nodeInfo *panel.NodeInfo, inbound *coreCon
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unmarshal httpupgrade settings error: %s", err)
|
return fmt.Errorf("unmarshal httpupgrade settings error: %s", err)
|
||||||
}
|
}
|
||||||
case "splithttp":
|
case "splithttp", "xhttp":
|
||||||
err := json.Unmarshal(v.NetworkSettings, &inbound.StreamSetting.SplitHTTPSettings)
|
err := json.Unmarshal(v.NetworkSettings, &inbound.StreamSetting.SplitHTTPSettings)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unmarshal splithttp settings error: %s", err)
|
return fmt.Errorf("unmarshal xhttp settings error: %s", err)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return errors.New("the network type is not vail")
|
return errors.New("the network type is not vail")
|
||||||
@@ -267,7 +262,7 @@ func buildTrojan(config *conf.Options, nodeInfo *panel.NodeInfo, inbound *coreCo
|
|||||||
return fmt.Errorf("unmarshal ws settings error: %s", err)
|
return fmt.Errorf("unmarshal ws settings error: %s", err)
|
||||||
}
|
}
|
||||||
case "grpc":
|
case "grpc":
|
||||||
err := json.Unmarshal(v.NetworkSettings, &inbound.StreamSetting.GRPCConfig)
|
err := json.Unmarshal(v.NetworkSettings, &inbound.StreamSetting.GRPCSettings)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unmarshal grpc settings error: %s", err)
|
return fmt.Errorf("unmarshal grpc settings error: %s", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,7 @@ func buildSSUser(tag string, userInfo *panel.UserInfo, cypher string, serverKey
|
|||||||
case "2022-blake3-chacha20-poly1305":
|
case "2022-blake3-chacha20-poly1305":
|
||||||
keyLength = 32
|
keyLength = 32
|
||||||
}
|
}
|
||||||
ssAccount := &shadowsocks_2022.User{
|
ssAccount := &shadowsocks_2022.Account{
|
||||||
Level: 0,
|
|
||||||
Email: format.UserTag(tag, userInfo.Uuid),
|
|
||||||
Key: base64.StdEncoding.EncodeToString([]byte(userInfo.Uuid[:keyLength])),
|
Key: base64.StdEncoding.EncodeToString([]byte(userInfo.Uuid[:keyLength])),
|
||||||
}
|
}
|
||||||
return &protocol.User{
|
return &protocol.User{
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func (c *Xray) GetUserManager(tag string) (proxy.UserManager, error) {
|
|||||||
return userManager, nil
|
return userManager, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Xray) DelUsers(users []panel.UserInfo, tag string) error {
|
func (c *Xray) DelUsers(users []panel.UserInfo, tag string, _ *panel.NodeInfo) error {
|
||||||
userManager, err := c.GetUserManager(tag)
|
userManager, err := c.GetUserManager(tag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("get user manager error: %s", err)
|
return fmt.Errorf("get user manager error: %s", err)
|
||||||
|
|||||||
@@ -28,9 +28,7 @@
|
|||||||
},
|
},
|
||||||
"DnsConfigPath": "/etc/V2bX/dns.json",
|
"DnsConfigPath": "/etc/V2bX/dns.json",
|
||||||
// SingBox源配置文件目录,用于引用标准SingBox配置文件
|
// SingBox源配置文件目录,用于引用标准SingBox配置文件
|
||||||
"OriginalPath": "/etc/V2bX/sing_origin.json",
|
"OriginalPath": "/etc/V2bX/sing_origin.json"
|
||||||
// 在删除用户时清理已建立的连接
|
|
||||||
"EnableConnClear": false,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Type": "sing",
|
"Type": "sing",
|
||||||
|
|||||||
262
go.mod
262
go.mod
@@ -5,38 +5,40 @@ go 1.23
|
|||||||
toolchain go1.23.2
|
toolchain go1.23.2
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/apernet/hysteria/core/v2 v2.5.2
|
github.com/apernet/hysteria/core/v2 v2.6.1
|
||||||
github.com/apernet/hysteria/extras/v2 v2.5.2
|
github.com/apernet/hysteria/extras/v2 v2.6.1
|
||||||
github.com/beevik/ntp v1.2.0
|
github.com/apernet/quic-go v0.49.1-0.20250204013113-43c72b1281a0
|
||||||
github.com/fsnotify/fsnotify v1.7.0
|
github.com/beevik/ntp v1.4.4-0.20240716062501-06ef196b89ec
|
||||||
github.com/go-acme/lego/v4 v4.17.4
|
github.com/fsnotify/fsnotify v1.8.0
|
||||||
github.com/go-resty/resty/v2 v2.13.1
|
github.com/go-acme/lego/v4 v4.21.1-0.20241220151055-ee7a9e4fa04f
|
||||||
github.com/goccy/go-json v0.10.3
|
github.com/go-resty/resty/v2 v2.16.2
|
||||||
github.com/hashicorp/go-multierror v1.1.1
|
github.com/goccy/go-json v0.10.4
|
||||||
|
github.com/hashicorp/go-multierror v1.1.2-0.20241119060415-613124da9385
|
||||||
github.com/juju/ratelimit v1.0.2
|
github.com/juju/ratelimit v1.0.2
|
||||||
github.com/sagernet/sing v0.5.0-beta.2
|
github.com/sagernet/sing v0.6.1-0.20250206032706-39a584083834
|
||||||
github.com/sagernet/sing-box v1.10.0-beta.11
|
github.com/sagernet/sing-box v1.12.0
|
||||||
github.com/sirupsen/logrus v1.9.3
|
github.com/sirupsen/logrus v1.9.3
|
||||||
github.com/spf13/cobra v1.8.0
|
github.com/spf13/cobra v1.8.1
|
||||||
github.com/spf13/viper v1.15.0
|
github.com/spf13/viper v1.19.0
|
||||||
github.com/xtls/xray-core v1.8.25-0.20241005021528-c30f5d47964b
|
github.com/xtls/xray-core v1.8.25-0.20250207135752-1d9e6bc2f376
|
||||||
go.uber.org/zap v1.27.0
|
go.uber.org/zap v1.27.0
|
||||||
golang.org/x/crypto v0.27.0
|
golang.org/x/crypto v0.32.0
|
||||||
golang.org/x/sys v0.25.0
|
golang.org/x/sys v0.30.0
|
||||||
google.golang.org/protobuf v1.34.2
|
google.golang.org/protobuf v1.36.5
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
berty.tech/go-libtor v1.0.385 // indirect
|
cloud.google.com/go/auth v0.13.0 // indirect
|
||||||
cloud.google.com/go/compute/metadata v0.5.0 // indirect
|
cloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect
|
||||||
|
cloud.google.com/go/compute/metadata v0.6.0 // indirect
|
||||||
github.com/AdamSLevy/jsonrpc2/v14 v14.1.0 // indirect
|
github.com/AdamSLevy/jsonrpc2/v14 v14.1.0 // indirect
|
||||||
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
|
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.12.0 // indirect
|
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 // indirect
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0 // indirect
|
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 // indirect
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.9.0 // indirect
|
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.2.0 // indirect
|
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.2.0 // indirect
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.2.0 // indirect
|
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns v1.3.0 // indirect
|
||||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.9.0 // indirect
|
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.9.0 // indirect
|
||||||
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
|
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
|
||||||
github.com/Azure/go-autorest/autorest v0.11.29 // indirect
|
github.com/Azure/go-autorest/autorest v0.11.29 // indirect
|
||||||
@@ -49,82 +51,87 @@ require (
|
|||||||
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
|
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
|
||||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
|
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
|
||||||
github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87 // indirect
|
github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87 // indirect
|
||||||
|
github.com/ajg/form v1.5.1 // indirect
|
||||||
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 // indirect
|
github.com/akamai/AkamaiOPEN-edgegrid-golang v1.2.2 // indirect
|
||||||
github.com/aliyun/alibaba-cloud-sdk-go v1.62.712 // indirect
|
github.com/aliyun/alibaba-cloud-sdk-go v1.63.72 // indirect
|
||||||
github.com/andybalholm/brotli v1.1.0 // indirect
|
github.com/andybalholm/brotli v1.1.0 // indirect
|
||||||
github.com/apernet/quic-go v0.47.1-0.20241004180137-a80d14e2080d // indirect
|
github.com/aws/aws-sdk-go-v2 v1.32.7 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2 v1.27.2 // indirect
|
github.com/aws/aws-sdk-go-v2/config v1.28.7 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/config v1.27.18 // indirect
|
github.com/aws/aws-sdk-go-v2/credentials v1.17.48 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.18 // indirect
|
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5 // indirect
|
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 // indirect
|
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 // indirect
|
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
|
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
|
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 // indirect
|
github.com/aws/aws-sdk-go-v2/service/lightsail v1.42.8 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/lightsail v1.38.3 // indirect
|
github.com/aws/aws-sdk-go-v2/service/route53 v1.46.4 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/route53 v1.40.10 // indirect
|
github.com/aws/aws-sdk-go-v2/service/sso v1.24.8 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/sso v1.20.11 // indirect
|
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5 // indirect
|
github.com/aws/aws-sdk-go-v2/service/sts v1.33.3 // indirect
|
||||||
github.com/aws/aws-sdk-go-v2/service/sts v1.28.12 // indirect
|
github.com/aws/smithy-go v1.22.1 // indirect
|
||||||
github.com/aws/smithy-go v1.20.2 // indirect
|
|
||||||
github.com/babolivier/go-doh-client v0.0.0-20201028162107-a76cff4cb8b6 // indirect
|
github.com/babolivier/go-doh-client v0.0.0-20201028162107-a76cff4cb8b6 // indirect
|
||||||
github.com/benbjohnson/clock v1.3.0 // indirect
|
github.com/benbjohnson/clock v1.3.0 // indirect
|
||||||
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
|
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc // indirect
|
||||||
github.com/caddyserver/certmagic v0.20.0 // indirect
|
github.com/caddyserver/certmagic v0.20.0 // indirect
|
||||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||||
github.com/civo/civogo v0.3.11 // indirect
|
github.com/civo/civogo v0.3.11 // indirect
|
||||||
github.com/cloudflare/circl v1.4.0 // indirect
|
github.com/cloudflare/circl v1.6.0 // indirect
|
||||||
github.com/cloudflare/cloudflare-go v0.97.0 // indirect
|
github.com/cloudflare/cloudflare-go v0.112.0 // indirect
|
||||||
github.com/cpu/goacmedns v0.1.1 // indirect
|
github.com/cpu/goacmedns v0.1.1 // indirect
|
||||||
github.com/cretz/bine v0.2.0 // indirect
|
github.com/cretz/bine v0.2.0 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/database64128/netx-go v0.0.0-20240905055117-62795b8b054a // indirect
|
||||||
github.com/deepmap/oapi-codegen v1.9.1 // indirect
|
github.com/database64128/tfo-go/v2 v2.2.2 // indirect
|
||||||
|
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||||
github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140 // indirect
|
github.com/dgryski/go-metro v0.0.0-20211217172704-adc40b04c140 // indirect
|
||||||
github.com/dimchansky/utfbom v1.1.1 // indirect
|
github.com/dimchansky/utfbom v1.1.1 // indirect
|
||||||
github.com/dnsimple/dnsimple-go v1.7.0 // indirect
|
github.com/dnsimple/dnsimple-go v1.7.0 // indirect
|
||||||
github.com/exoscale/egoscale v0.102.3 // indirect
|
github.com/exoscale/egoscale/v3 v3.1.7 // indirect
|
||||||
github.com/fatih/structs v1.1.0 // indirect
|
github.com/fatih/structs v1.1.0 // indirect
|
||||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||||
|
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
||||||
github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344 // indirect
|
github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344 // indirect
|
||||||
github.com/go-chi/chi/v5 v5.0.12 // indirect
|
github.com/go-chi/chi/v5 v5.2.1 // indirect
|
||||||
|
github.com/go-chi/render v1.0.3 // indirect
|
||||||
github.com/go-errors/errors v1.0.1 // indirect
|
github.com/go-errors/errors v1.0.1 // indirect
|
||||||
github.com/go-jose/go-jose/v4 v4.0.2 // indirect
|
github.com/go-jose/go-jose/v4 v4.0.4 // indirect
|
||||||
github.com/go-logr/logr v1.4.1 // indirect
|
github.com/go-logr/logr v1.4.2 // indirect
|
||||||
github.com/go-logr/stdr v1.2.2 // indirect
|
github.com/go-logr/stdr v1.2.2 // indirect
|
||||||
github.com/go-ole/go-ole v1.3.0 // indirect
|
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||||
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
|
github.com/go-playground/validator/v10 v10.16.0 // indirect
|
||||||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
||||||
github.com/go-viper/mapstructure/v2 v2.0.0 // indirect
|
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
|
||||||
github.com/gobwas/httphead v0.1.0 // indirect
|
github.com/gobwas/httphead v0.1.0 // indirect
|
||||||
github.com/gobwas/pool v0.2.1 // indirect
|
github.com/gobwas/pool v0.2.1 // indirect
|
||||||
github.com/gofrs/flock v0.8.1 // indirect
|
github.com/gofrs/flock v0.12.1 // indirect
|
||||||
github.com/gofrs/uuid v4.4.0+incompatible // indirect
|
github.com/gofrs/uuid/v5 v5.3.0 // indirect
|
||||||
github.com/gofrs/uuid/v5 v5.2.0 // indirect
|
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
|
||||||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
|
||||||
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
|
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/google/btree v1.1.3 // indirect
|
||||||
github.com/golang/protobuf v1.5.4 // indirect
|
|
||||||
github.com/google/btree v1.1.2 // indirect
|
|
||||||
github.com/google/go-cmp v0.6.0 // indirect
|
github.com/google/go-cmp v0.6.0 // indirect
|
||||||
github.com/google/go-querystring v1.1.0 // indirect
|
github.com/google/go-querystring v1.1.0 // indirect
|
||||||
github.com/google/pprof v0.0.0-20240528025155-186aa0362fba // indirect
|
github.com/google/pprof v0.0.0-20240528025155-186aa0362fba // indirect
|
||||||
github.com/google/s2a-go v0.1.7 // indirect
|
github.com/google/s2a-go v0.1.8 // indirect
|
||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
|
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
|
||||||
github.com/googleapis/gax-go/v2 v2.12.3 // indirect
|
github.com/googleapis/gax-go/v2 v2.14.0 // indirect
|
||||||
github.com/gophercloud/gophercloud v1.12.0 // indirect
|
github.com/gophercloud/gophercloud v1.14.1 // indirect
|
||||||
github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56 // indirect
|
github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56 // indirect
|
||||||
github.com/gorilla/websocket v1.5.3 // indirect
|
github.com/gorilla/websocket v1.5.3 // indirect
|
||||||
github.com/hashicorp/errwrap v1.0.0 // indirect
|
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||||
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
|
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
|
||||||
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
github.com/hashicorp/go-uuid v1.0.3 // indirect
|
||||||
github.com/hashicorp/golang-lru/v2 v2.0.5 // indirect
|
github.com/hashicorp/golang-lru/v2 v2.0.5 // indirect
|
||||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||||
github.com/hashicorp/yamux v0.1.1 // indirect
|
github.com/hashicorp/yamux v0.1.2 // indirect
|
||||||
|
github.com/huaweicloud/huaweicloud-sdk-go-v3 v0.1.128 // indirect
|
||||||
github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df // indirect
|
github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/infobloxopen/infoblox-go-client v1.1.1 // indirect
|
github.com/infobloxopen/infoblox-go-client v1.1.1 // indirect
|
||||||
|
github.com/insomniacslk/dhcp v0.0.0-20250109001534-8abf58130905 // indirect
|
||||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||||
github.com/josharian/native v1.1.0 // indirect
|
github.com/josharian/native v1.1.0 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
@@ -135,10 +142,11 @@ require (
|
|||||||
github.com/kylelemons/godebug v1.1.0 // indirect
|
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||||
github.com/labbsr0x/bindman-dns-webhook v1.0.2 // indirect
|
github.com/labbsr0x/bindman-dns-webhook v1.0.2 // indirect
|
||||||
github.com/labbsr0x/goh v1.0.1 // indirect
|
github.com/labbsr0x/goh v1.0.1 // indirect
|
||||||
|
github.com/leodido/go-urn v1.2.4 // indirect
|
||||||
github.com/libdns/alidns v1.0.3 // indirect
|
github.com/libdns/alidns v1.0.3 // indirect
|
||||||
github.com/libdns/cloudflare v0.1.1 // indirect
|
github.com/libdns/cloudflare v0.1.1 // indirect
|
||||||
github.com/libdns/libdns v0.2.2 // indirect
|
github.com/libdns/libdns v0.2.2 // indirect
|
||||||
github.com/linode/linodego v1.28.0 // indirect
|
github.com/linode/linodego v1.44.0 // indirect
|
||||||
github.com/liquidweb/liquidweb-cli v0.6.9 // indirect
|
github.com/liquidweb/liquidweb-cli v0.6.9 // indirect
|
||||||
github.com/liquidweb/liquidweb-go v1.6.4 // indirect
|
github.com/liquidweb/liquidweb-go v1.6.4 // indirect
|
||||||
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
|
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
|
||||||
@@ -146,9 +154,9 @@ require (
|
|||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mdlayher/netlink v1.7.2 // indirect
|
github.com/mdlayher/netlink v1.7.2 // indirect
|
||||||
github.com/mdlayher/socket v0.4.1 // indirect
|
github.com/mdlayher/socket v0.4.1 // indirect
|
||||||
github.com/metacubex/tfo-go v0.0.0-20240821025650-e9be0afd5e7d // indirect
|
github.com/metacubex/tfo-go v0.0.0-20241231083714-66613d49c422 // indirect
|
||||||
github.com/mholt/acmez v1.2.0 // indirect
|
github.com/mholt/acmez v1.2.0 // indirect
|
||||||
github.com/miekg/dns v1.1.62 // indirect
|
github.com/miekg/dns v1.1.63 // indirect
|
||||||
github.com/mimuret/golang-iij-dpf v0.9.1 // indirect
|
github.com/mimuret/golang-iij-dpf v0.9.1 // indirect
|
||||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||||
@@ -157,119 +165,127 @@ require (
|
|||||||
github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04 // indirect
|
github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04 // indirect
|
||||||
github.com/nrdcg/auroradns v1.1.0 // indirect
|
github.com/nrdcg/auroradns v1.1.0 // indirect
|
||||||
github.com/nrdcg/bunny-go v0.0.0-20240207213615-dde5bf4577a3 // indirect
|
github.com/nrdcg/bunny-go v0.0.0-20240207213615-dde5bf4577a3 // indirect
|
||||||
github.com/nrdcg/desec v0.8.0 // indirect
|
github.com/nrdcg/desec v0.10.0 // indirect
|
||||||
github.com/nrdcg/dnspod-go v0.4.0 // indirect
|
github.com/nrdcg/dnspod-go v0.4.0 // indirect
|
||||||
github.com/nrdcg/freemyip v0.2.0 // indirect
|
github.com/nrdcg/freemyip v0.3.0 // indirect
|
||||||
github.com/nrdcg/goinwx v0.10.0 // indirect
|
github.com/nrdcg/goinwx v0.10.0 // indirect
|
||||||
github.com/nrdcg/mailinabox v0.2.0 // indirect
|
github.com/nrdcg/mailinabox v0.2.0 // indirect
|
||||||
github.com/nrdcg/namesilo v0.2.1 // indirect
|
github.com/nrdcg/namesilo v0.2.1 // indirect
|
||||||
github.com/nrdcg/nodion v0.1.0 // indirect
|
github.com/nrdcg/nodion v0.1.0 // indirect
|
||||||
github.com/nrdcg/porkbun v0.3.0 // indirect
|
github.com/nrdcg/porkbun v0.4.0 // indirect
|
||||||
github.com/nzdjb/go-metaname v1.0.0 // indirect
|
github.com/nzdjb/go-metaname v1.0.0 // indirect
|
||||||
github.com/onsi/ginkgo/v2 v2.19.0 // indirect
|
github.com/onsi/ginkgo/v2 v2.19.0 // indirect
|
||||||
github.com/ooni/go-libtor v1.1.8 // indirect
|
|
||||||
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
|
github.com/opentracing/opentracing-go v1.2.1-0.20220228012449-10b1cf09e00b // indirect
|
||||||
github.com/oracle/oci-go-sdk/v65 v65.63.1 // indirect
|
github.com/oracle/oci-go-sdk/v65 v65.81.1 // indirect
|
||||||
github.com/oschwald/maxminddb-golang v1.12.0 // indirect
|
github.com/ovh/go-ovh v1.6.0 // indirect
|
||||||
github.com/ovh/go-ovh v1.5.1 // indirect
|
|
||||||
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
|
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
|
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||||
github.com/pires/go-proxyproto v0.7.0 // indirect
|
github.com/peterhellberg/link v1.2.0 // indirect
|
||||||
|
github.com/pierrec/lz4/v4 v4.1.17 // indirect
|
||||||
|
github.com/pires/go-proxyproto v0.8.0 // indirect
|
||||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||||
github.com/pquerna/otp v1.4.0 // indirect
|
github.com/pquerna/otp v1.4.0 // indirect
|
||||||
github.com/quic-go/qpack v0.5.1 // indirect
|
github.com/quic-go/qpack v0.5.1 // indirect
|
||||||
github.com/quic-go/qtls-go1-20 v0.4.1 // indirect
|
github.com/quic-go/qtls-go1-20 v0.4.1 // indirect
|
||||||
github.com/quic-go/quic-go v0.46.0 // indirect
|
github.com/quic-go/quic-go v0.49.0 // indirect
|
||||||
github.com/refraction-networking/utls v1.6.7 // indirect
|
github.com/refraction-networking/utls v1.6.7 // indirect
|
||||||
|
github.com/regfish/regfish-dnsapi-go v0.1.1 // indirect
|
||||||
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect
|
github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect
|
||||||
github.com/sacloud/api-client-go v0.2.10 // indirect
|
github.com/sacloud/api-client-go v0.2.10 // indirect
|
||||||
github.com/sacloud/go-http v0.1.8 // indirect
|
github.com/sacloud/go-http v0.1.8 // indirect
|
||||||
github.com/sacloud/iaas-api-go v1.12.0 // indirect
|
github.com/sacloud/iaas-api-go v1.14.0 // indirect
|
||||||
github.com/sacloud/packages-go v0.0.10 // indirect
|
github.com/sacloud/packages-go v0.0.10 // indirect
|
||||||
github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a // indirect
|
github.com/sagernet/bbolt v0.0.0-20231014093535-ea5cb2fe9f0a // indirect
|
||||||
github.com/sagernet/cloudflare-tls v0.0.0-20231208171750-a4483c1b7cd1 // indirect
|
github.com/sagernet/cloudflare-tls v0.0.0-20231208171750-a4483c1b7cd1 // indirect
|
||||||
|
github.com/sagernet/cors v1.2.1 // indirect
|
||||||
github.com/sagernet/fswatch v0.1.1 // indirect
|
github.com/sagernet/fswatch v0.1.1 // indirect
|
||||||
github.com/sagernet/gvisor v0.0.0-20240428053021-e691de28565f // indirect
|
github.com/sagernet/gvisor v0.0.0-20241123041152-536d05261cff // indirect
|
||||||
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a // indirect
|
github.com/sagernet/netlink v0.0.0-20240612041022-b9a21c07ac6a // indirect
|
||||||
github.com/sagernet/nftables v0.3.0-beta.4 // indirect
|
github.com/sagernet/nftables v0.3.0-beta.4 // indirect
|
||||||
github.com/sagernet/quic-go v0.47.0-beta.2 // indirect
|
github.com/sagernet/quic-go v0.49.0-beta.1 // indirect
|
||||||
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 // indirect
|
github.com/sagernet/reality v0.0.0-20230406110435-ee17307e7691 // indirect
|
||||||
github.com/sagernet/sing-dns v0.3.0-beta.14 // indirect
|
github.com/sagernet/sing-mux v0.3.1 // indirect
|
||||||
github.com/sagernet/sing-mux v0.2.0 // indirect
|
github.com/sagernet/sing-quic v0.4.0 // indirect
|
||||||
github.com/sagernet/sing-quic v0.3.0-beta.3 // indirect
|
|
||||||
github.com/sagernet/sing-shadowsocks v0.2.7 // indirect
|
github.com/sagernet/sing-shadowsocks v0.2.7 // indirect
|
||||||
github.com/sagernet/sing-shadowsocks2 v0.2.0 // indirect
|
github.com/sagernet/sing-shadowsocks2 v0.2.0 // indirect
|
||||||
github.com/sagernet/sing-shadowtls v0.1.4 // indirect
|
github.com/sagernet/sing-shadowtls v0.2.0 // indirect
|
||||||
github.com/sagernet/sing-tun v0.4.0-beta.16 // indirect
|
github.com/sagernet/sing-tun v0.6.0 // indirect
|
||||||
github.com/sagernet/sing-vmess v0.1.12 // indirect
|
github.com/sagernet/sing-vmess v0.2.0 // indirect
|
||||||
github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 // indirect
|
github.com/sagernet/smux v0.0.0-20231208180855-7041f6ea79e7 // indirect
|
||||||
github.com/sagernet/utls v1.6.7 // indirect
|
github.com/sagernet/utls v1.6.7 // indirect
|
||||||
github.com/sagernet/wireguard-go v0.0.0-20231215174105-89dec3b2f3e8 // indirect
|
github.com/sagernet/wireguard-go v0.0.1-beta.5 // indirect
|
||||||
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 // indirect
|
github.com/sagernet/ws v0.0.0-20231204124109-acfe8907c854 // indirect
|
||||||
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.27 // indirect
|
github.com/sagikazarmark/locafero v0.4.0 // indirect
|
||||||
|
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||||
|
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30 // indirect
|
||||||
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 // indirect
|
github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 // indirect
|
||||||
github.com/selectel/domains-go v1.1.0 // indirect
|
github.com/selectel/domains-go v1.1.0 // indirect
|
||||||
github.com/selectel/go-selvpcclient/v3 v3.1.1 // indirect
|
github.com/selectel/go-selvpcclient/v3 v3.2.1 // indirect
|
||||||
github.com/shopspring/decimal v1.3.1 // indirect
|
github.com/shopspring/decimal v1.3.1 // indirect
|
||||||
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9 // indirect
|
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9 // indirect
|
||||||
github.com/softlayer/softlayer-go v1.1.5 // indirect
|
github.com/softlayer/softlayer-go v1.1.7 // indirect
|
||||||
github.com/softlayer/xmlrpc v0.0.0-20200409220501-5f089df7cb7e // indirect
|
github.com/softlayer/xmlrpc v0.0.0-20200409220501-5f089df7cb7e // indirect
|
||||||
github.com/sony/gobreaker v0.5.0 // indirect
|
github.com/sony/gobreaker v0.5.0 // indirect
|
||||||
github.com/spf13/afero v1.9.3 // indirect
|
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||||
github.com/spf13/cast v1.5.0 // indirect
|
github.com/spf13/afero v1.11.0 // indirect
|
||||||
github.com/spf13/jwalterweatherman v1.1.0 // indirect
|
github.com/spf13/cast v1.6.0 // indirect
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
github.com/spf13/pflag v1.0.5 // indirect
|
||||||
github.com/stretchr/objx v0.5.2 // indirect
|
github.com/stretchr/objx v0.5.2 // indirect
|
||||||
github.com/stretchr/testify v1.9.0 // indirect
|
github.com/stretchr/testify v1.10.0 // indirect
|
||||||
github.com/subosito/gotenv v1.4.2 // indirect
|
github.com/subosito/gotenv v1.6.0 // indirect
|
||||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.898 // indirect
|
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.1065 // indirect
|
||||||
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.898 // indirect
|
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/dnspod v1.0.1065 // indirect
|
||||||
github.com/transip/gotransip/v6 v6.23.0 // indirect
|
github.com/tjfoc/gmsm v1.4.1 // indirect
|
||||||
|
github.com/transip/gotransip/v6 v6.26.0 // indirect
|
||||||
github.com/txthinking/runnergroup v0.0.0-20210608031112-152c7c4432bf // indirect
|
github.com/txthinking/runnergroup v0.0.0-20210608031112-152c7c4432bf // indirect
|
||||||
github.com/txthinking/socks5 v0.0.0-20230325130024-4230056ae301 // indirect
|
github.com/txthinking/socks5 v0.0.0-20230325130024-4230056ae301 // indirect
|
||||||
github.com/ultradns/ultradns-go-sdk v1.6.1-20231103022937-8589b6a // indirect
|
github.com/u-root/uio v0.0.0-20230220225925-ffce2a382923 // indirect
|
||||||
|
github.com/ultradns/ultradns-go-sdk v1.8.0-20241010134910-243eeec // indirect
|
||||||
github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e // indirect
|
github.com/v2fly/ss-bloomring v0.0.0-20210312155135-28617310f63e // indirect
|
||||||
github.com/vinyldns/go-vinyldns v0.9.16 // indirect
|
github.com/vinyldns/go-vinyldns v0.9.16 // indirect
|
||||||
github.com/vishvananda/netlink v1.3.0 // indirect
|
github.com/vishvananda/netlink v1.3.0 // indirect
|
||||||
github.com/vishvananda/netns v0.0.4 // indirect
|
github.com/vishvananda/netns v0.0.4 // indirect
|
||||||
github.com/vultr/govultr/v2 v2.17.2 // indirect
|
github.com/volcengine/volc-sdk-golang v1.0.189 // indirect
|
||||||
|
github.com/vultr/govultr/v3 v3.9.1 // indirect
|
||||||
|
github.com/wyx2685/sing-vmess v0.0.0-20250208043059-9bd6d628dc1c // indirect
|
||||||
github.com/xtls/reality v0.0.0-20240909153216-e26ae2305463 // indirect
|
github.com/xtls/reality v0.0.0-20240909153216-e26ae2305463 // indirect
|
||||||
github.com/yandex-cloud/go-genproto v0.0.0-20240318083951-4fe6125f286e // indirect
|
github.com/yandex-cloud/go-genproto v0.0.0-20241220122821-aeb3b05efd1c // indirect
|
||||||
github.com/yandex-cloud/go-sdk v0.0.0-20240318084659-dfa50323a0b4 // indirect
|
github.com/yandex-cloud/go-sdk v0.0.0-20241220131134-2393e243c134 // indirect
|
||||||
github.com/zeebo/blake3 v0.2.3 // indirect
|
github.com/zeebo/blake3 v0.2.3 // indirect
|
||||||
go.opencensus.io v0.24.0 // indirect
|
go.mongodb.org/mongo-driver v1.12.0 // indirect
|
||||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
|
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
|
||||||
go.opentelemetry.io/otel v1.24.0 // indirect
|
go.opentelemetry.io/otel v1.32.0 // indirect
|
||||||
go.opentelemetry.io/otel/metric v1.24.0 // indirect
|
go.opentelemetry.io/otel/metric v1.32.0 // indirect
|
||||||
go.opentelemetry.io/otel/trace v1.24.0 // indirect
|
go.opentelemetry.io/otel/trace v1.32.0 // indirect
|
||||||
go.uber.org/mock v0.4.0 // indirect
|
go.uber.org/mock v0.5.0 // indirect
|
||||||
go.uber.org/multierr v1.11.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
go.uber.org/ratelimit v0.3.0 // indirect
|
go.uber.org/ratelimit v0.3.0 // indirect
|
||||||
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
|
go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect
|
||||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
|
golang.org/x/exp v0.0.0-20241210194714-1829a127f884 // indirect
|
||||||
golang.org/x/mod v0.19.0 // indirect
|
golang.org/x/mod v0.22.0 // indirect
|
||||||
golang.org/x/net v0.29.0 // indirect
|
golang.org/x/net v0.34.0 // indirect
|
||||||
golang.org/x/oauth2 v0.22.0 // indirect
|
golang.org/x/oauth2 v0.24.0 // indirect
|
||||||
golang.org/x/sync v0.8.0 // indirect
|
golang.org/x/sync v0.11.0 // indirect
|
||||||
golang.org/x/text v0.18.0 // indirect
|
golang.org/x/text v0.21.0 // indirect
|
||||||
golang.org/x/time v0.5.0 // indirect
|
golang.org/x/time v0.8.0 // indirect
|
||||||
golang.org/x/tools v0.23.0 // indirect
|
golang.org/x/tools v0.28.0 // indirect
|
||||||
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
|
golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect
|
||||||
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 // indirect
|
golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 // indirect
|
||||||
google.golang.org/api v0.172.0 // indirect
|
google.golang.org/api v0.214.0 // indirect
|
||||||
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
|
google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38 // indirect
|
||||||
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
|
google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
|
||||||
google.golang.org/grpc v1.67.1 // indirect
|
google.golang.org/grpc v1.70.0 // indirect
|
||||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||||
gopkg.in/ns1/ns1-go.v2 v2.7.13 // indirect
|
gopkg.in/ns1/ns1-go.v2 v2.13.0 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
gvisor.dev/gvisor v0.0.0-20231202080848-1f7806d17489 // indirect
|
gvisor.dev/gvisor v0.0.0-20240320123526-dc6abceb7ff0 // indirect
|
||||||
lukechampine.com/blake3 v1.3.0 // indirect
|
lukechampine.com/blake3 v1.3.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
// replace github.com/sagernet/sing-box v1.10.0-alpha.22 => /root/sing-box_mod
|
//replace github.com/sagernet/sing-box v1.12.0 => /root/sing-box_mod
|
||||||
replace github.com/sagernet/sing-box v1.10.0-beta.11 => github.com/wyx2685/sing-box_mod v1.10.0-beta.11
|
|
||||||
|
replace github.com/sagernet/sing-box v1.12.0 => github.com/wyx2685/sing-box_mod v1.12.0-alpha.4.0.20250208043349-10516a449eb5
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ type Limiter struct {
|
|||||||
ProtocolRules []string
|
ProtocolRules []string
|
||||||
SpeedLimit int
|
SpeedLimit int
|
||||||
UserOnlineIP *sync.Map // Key: Name, value: {Key: Ip, value: Uid}
|
UserOnlineIP *sync.Map // Key: Name, value: {Key: Ip, value: Uid}
|
||||||
OldUserOnline map[string]int // Key: Ip, value: Uid
|
OldUserOnline *sync.Map // Key: Ip, value: Uid
|
||||||
UUIDtoUID map[string]int // Key: UUID, value: Uid
|
UUIDtoUID map[string]int // Key: UUID, value: Uid
|
||||||
UserLimitInfo *sync.Map // Key: Uid value: UserLimitInfo
|
UserLimitInfo *sync.Map // Key: Uid value: UserLimitInfo
|
||||||
ConnLimiter *ConnLimiter // Key: Uid value: ConnLimiter
|
ConnLimiter *ConnLimiter // Key: Uid value: ConnLimiter
|
||||||
@@ -62,7 +62,7 @@ func AddLimiter(tag string, l *conf.LimitConfig, users []panel.UserInfo, aliveLi
|
|||||||
ConnLimiter: NewConnLimiter(l.ConnLimit, l.IPLimit, l.EnableRealtime),
|
ConnLimiter: NewConnLimiter(l.ConnLimit, l.IPLimit, l.EnableRealtime),
|
||||||
SpeedLimiter: new(sync.Map),
|
SpeedLimiter: new(sync.Map),
|
||||||
AliveList: aliveList,
|
AliveList: aliveList,
|
||||||
OldUserOnline: make(map[string]int),
|
OldUserOnline: new(sync.Map),
|
||||||
}
|
}
|
||||||
uuidmap := make(map[string]int)
|
uuidmap := make(map[string]int)
|
||||||
for i := range users {
|
for i := range users {
|
||||||
@@ -182,8 +182,10 @@ func (l *Limiter) CheckLimit(taguuid string, ip string, isTcp bool, noSSUDP bool
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if l.OldUserOnline[ip] == uid {
|
} else if v, ok := l.OldUserOnline.Load(ip); ok{
|
||||||
delete(l.OldUserOnline, ip)
|
if v.(int) == uid {
|
||||||
|
l.OldUserOnline.Delete(ip)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if deviceLimit > 0 {
|
if deviceLimit > 0 {
|
||||||
if deviceLimit <= aliveIp {
|
if deviceLimit <= aliveIp {
|
||||||
@@ -216,7 +218,7 @@ func (l *Limiter) GetOnlineDevice() (*[]panel.OnlineUser, error) {
|
|||||||
ipMap.Range(func(key, value interface{}) bool {
|
ipMap.Range(func(key, value interface{}) bool {
|
||||||
uid := value.(int)
|
uid := value.(int)
|
||||||
ip := key.(string)
|
ip := key.(string)
|
||||||
l.OldUserOnline[ip] = uid
|
l.OldUserOnline.Store(ip, uid)
|
||||||
onlineUser = append(onlineUser, panel.OnlineUser{UID: uid, IP: ip})
|
onlineUser = append(onlineUser, panel.OnlineUser{UID: uid, IP: ip})
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|||||||
12
node/task.go
12
node/task.go
@@ -71,7 +71,11 @@ func (c *Controller) nodeInfoMonitor() (err error) {
|
|||||||
// get user alive
|
// get user alive
|
||||||
newA, err := c.apiClient.GetUserAlive()
|
newA, err := c.apiClient.GetUserAlive()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
log.WithFields(log.Fields{
|
||||||
|
"tag": c.tag,
|
||||||
|
"err": err,
|
||||||
|
}).Error("Get alive list failed")
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
if newN != nil {
|
if newN != nil {
|
||||||
c.info = newN
|
c.info = newN
|
||||||
@@ -100,6 +104,10 @@ func (c *Controller) nodeInfoMonitor() (err error) {
|
|||||||
l := limiter.AddLimiter(c.tag, &c.LimitConfig, c.userList, newA)
|
l := limiter.AddLimiter(c.tag, &c.LimitConfig, c.userList, newA)
|
||||||
c.limiter = l
|
c.limiter = l
|
||||||
}
|
}
|
||||||
|
// update alive list
|
||||||
|
if newA != nil {
|
||||||
|
c.limiter.AliveList = newA
|
||||||
|
}
|
||||||
// Update rule
|
// Update rule
|
||||||
err = c.limiter.UpdateRule(&newN.Rules)
|
err = c.limiter.UpdateRule(&newN.Rules)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -170,7 +178,7 @@ func (c *Controller) nodeInfoMonitor() (err error) {
|
|||||||
deleted, added := compareUserList(c.userList, newU)
|
deleted, added := compareUserList(c.userList, newU)
|
||||||
if len(deleted) > 0 {
|
if len(deleted) > 0 {
|
||||||
// have deleted users
|
// have deleted users
|
||||||
err = c.server.DelUsers(deleted, c.tag)
|
err = c.server.DelUsers(deleted, c.tag, c.info)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithFields(log.Fields{
|
log.WithFields(log.Fields{
|
||||||
"tag": c.tag,
|
"tag": c.tag,
|
||||||
|
|||||||
Reference in New Issue
Block a user