Compare commits

...
2 changed files with 14 additions and 14 deletions
+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)
```
+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 != "" {