Compare commits

...
5 changed files with 16 additions and 20 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM golang:1.25-alpine AS builder
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS builder
LABEL maintainer="shtorm-7"
COPY . /go/src/github.com/sagernet/sing-box
WORKDIR /go/src/github.com/sagernet/sing-box
+3 -3
View File
@@ -48,11 +48,11 @@ If you want to support the project, you can donate to the following addresses.
#### Tribute
**[RUB Donate](https://t.me/tribute/app?startapp=dJxY)**
**[RUB Donate](https://web.tribute.tg/d/JxY)**
**[EUR Donate](https://t.me/tribute/app?startapp=dJxZ)**
**[EUR Donate](https://web.tribute.tg/d/JxZ)**
**[USD Donate](https://t.me/tribute/app?startapp=dJy1)**
**[USD Donate](https://web.tribute.tg/d/Jy1)**
#### TRX (Tron)
```
+1 -2
View File
@@ -79,7 +79,6 @@ require (
github.com/panjf2000/ants/v2 v2.12.0 // indirect
github.com/quic-go/quic-go v0.59.0 // indirect
github.com/tylertreat/BoomFilters v0.0.0-20251117164519-53813c36cc1b // indirect
github.com/yl2chen/cidranger v1.0.2 // indirect
gvisor.dev/gvisor v0.0.0-20260408064518-65a410b0d584 // indirect
)
@@ -236,7 +235,7 @@ replace github.com/sagernet/sing-vmess => github.com/starifly/sing-vmess v0.2.7-
replace github.com/patrickmn/go-cache/v2 => github.com/shtorm-7/go-cache/v2 v2.1.0-extended-1.0.2
replace github.com/dolonet/mtg-multi => github.com/shtorm-7/mtg-multi v1.8.0-extended-1.0.0
replace github.com/dolonet/mtg-multi => github.com/shtorm-7/mtg-multi v1.8.0-extended-1.0.1
replace github.com/Diniboy1123/connect-ip-go => github.com/shtorm-7/connect-ip-go v1.0.0-extended-1.0.0
-3
View File
@@ -6,7 +6,6 @@ import (
"github.com/dolonet/mtg-multi/antireplay"
"github.com/dolonet/mtg-multi/events"
"github.com/dolonet/mtg-multi/ipblocklist"
"github.com/dolonet/mtg-multi/mtglib"
"github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing-box/adapter/inbound"
@@ -59,8 +58,6 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
Logger: mtgLogger,
Network: NewNetworkAdapter(ctx, NewDialer(inbound.newConnection)),
AntiReplayCache: antireplay.NewNoop(),
IPBlocklist: ipblocklist.NewNoop(),
IPAllowlist: ipblocklist.NewNoop(),
EventStream: events.NewNoopStream(),
Secrets: secrets,
+11 -11
View File
@@ -68,7 +68,7 @@ func NewEndpoint(ctx context.Context, router adapter.Router, logger log.ContextL
}
}
if config == nil {
config, err := endpoint.createConfig()
config, err = endpoint.createConfig()
if err != nil {
logger.ErrorContext(ctx, err)
return
@@ -183,6 +183,16 @@ func (w *Endpoint) isEndpointInitialized(ctx context.Context) error {
}
func (w *Endpoint) createConfig() (*Config, error) {
opts := make([]cloudflare.CloudflareApiOption, 0, 1)
if w.options.Profile.Detour != "" {
detour, ok := service.FromContext[adapter.OutboundManager](w.ctx).Outbound(w.options.Profile.Detour)
if !ok {
return nil, E.New("outbound detour not found: ", w.options.Profile.Detour)
}
opts = append(opts, cloudflare.WithDialContext(func(ctx context.Context, network, addr string) (net.Conn, error) {
return detour.DialContext(ctx, network, M.ParseSocksaddr(addr))
}))
}
var privateKey wgtypes.Key
var err error
if w.options.Profile.PrivateKey != "" {
@@ -196,16 +206,6 @@ func (w *Endpoint) createConfig() (*Config, error) {
return nil, err
}
}
opts := make([]cloudflare.CloudflareApiOption, 0, 1)
if w.options.Profile.Detour != "" {
detour, ok := service.FromContext[adapter.OutboundManager](w.ctx).Outbound(w.options.Profile.Detour)
if !ok {
return nil, E.New("outbound detour not found: ", w.options.Profile.Detour)
}
opts = append(opts, cloudflare.WithDialContext(func(ctx context.Context, network, addr string) (net.Conn, error) {
return detour.DialContext(ctx, network, M.ParseSocksaddr(addr))
}))
}
api := cloudflare.NewCloudflareApi(opts...)
var profile *cloudflare.CloudflareProfile
if w.options.Profile.AuthToken != "" && w.options.Profile.ID != "" {