mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-10-30 20:45:13 +08:00
Update 002-support-clash-proxy-providers.patch
This commit is contained in:
1 parent
e2c83dbb9d
commit
36e5628554
1 file changed
+17
-35
@@ -337,66 +337,48 @@ index ef88ff3..1f7d14d 100644
|
|||||||
|
|
||||||
func getProxyDelay(server *Server) func(w http.ResponseWriter, r *http.Request) {
|
func getProxyDelay(server *Server) func(w http.ResponseWriter, r *http.Request) {
|
||||||
diff --git a/experimental/clashapi/server.go b/experimental/clashapi/server.go
|
diff --git a/experimental/clashapi/server.go b/experimental/clashapi/server.go
|
||||||
index 950dca0..e4c1210 100644
|
index b9222ad5440..d4fd9dd3db1 100644
|
||||||
--- a/experimental/clashapi/server.go
|
--- a/experimental/clashapi/server.go
|
||||||
+++ b/experimental/clashapi/server.go
|
+++ b/experimental/clashapi/server.go
|
||||||
@@ -60,6 +60,7 @@ type Server struct {
|
@@ -57,6 +57,7 @@ type Server struct {
|
||||||
externalUI string
|
externalUI string
|
||||||
externalUIDownloadURL string
|
externalUIDownloadURL string
|
||||||
externalUIDownloadDetour string
|
externalUIDownloadDetour string
|
||||||
+ proxyProviders []option.ClashProxyProviderOptions
|
+ proxyProviders []option.ClashProxyProviderOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewServer(ctx context.Context, logFactory log.ObservableFactory, options option.ClashAPIOptions) (adapter.ClashServer, error) {
|
func NewServer(ctx context.Context, logFactory log.ObservableFactory, options option.ClashAPIOptions) (adapter.LifecycleService, error) {
|
||||||
@@ -82,6 +83,7 @@ func NewServer(ctx context.Context, logFactory log.ObservableFactory, options op
|
@@ -92,6 +93,7 @@ func NewServer(ctx context.Context, logFactory log.ObservableFactory, options op
|
||||||
externalController: options.ExternalController != "",
|
externalController: options.ExternalController != "",
|
||||||
externalUIDownloadURL: options.ExternalUIDownloadURL,
|
externalUIDownloadURL: options.ExternalUIDownloadURL,
|
||||||
externalUIDownloadDetour: options.ExternalUIDownloadDetour,
|
externalUIDownloadDetour: options.ExternalUIDownloadDetour,
|
||||||
+ proxyProviders: options.ProxyProviders,
|
+ proxyProviders: options.ProxyProviders,
|
||||||
}
|
}
|
||||||
s.urlTestHistory = service.FromContext[adapter.URLTestHistoryStorage](ctx)
|
//goland:noinspection GoDeprecation
|
||||||
if s.urlTestHistory == nil {
|
//nolint:staticcheck
|
||||||
@@ -122,7 +124,7 @@ func NewServer(ctx context.Context, logFactory log.ObservableFactory, options op
|
@@ -120,7 +122,7 @@ func NewServer(ctx context.Context, logFactory log.ObservableFactory, options op
|
||||||
r.Mount("/proxies", proxyRouter(s, s.router))
|
r.Mount("/proxies", proxyRouter(s, s.router))
|
||||||
r.Mount("/rules", ruleRouter(s.router))
|
r.Mount("/rules", ruleRouter(s.router))
|
||||||
r.Mount("/connections", connectionRouter(s.ctx, s.router, trafficManager))
|
r.Mount("/connections", connectionRouter(s.ctx, s.network, trafficManager))
|
||||||
- r.Mount("/providers/proxies", proxyProviderRouter())
|
- r.Mount("/providers/proxies", proxyProviderRouter())
|
||||||
+ r.Mount("/providers/proxies", proxyProviderRouter(s))
|
+ r.Mount("/providers/proxies", proxyProviderRouter(s))
|
||||||
r.Mount("/providers/rules", ruleProviderRouter())
|
r.Mount("/providers/rules", ruleProviderRouter())
|
||||||
r.Mount("/script", scriptRouter())
|
r.Mount("/script", scriptRouter())
|
||||||
r.Mount("/profile", profileRouter())
|
r.Mount("/profile", profileRouter())
|
||||||
diff --git a/option/experimental.go b/option/experimental.go
|
diff --git a/option/experimental.go b/option/experimental.go
|
||||||
index bf0df9e..50de31d 100644
|
index bf144ad4452..89f303a7b26 100644
|
||||||
--- a/option/experimental.go
|
--- a/option/experimental.go
|
||||||
+++ b/option/experimental.go
|
+++ b/option/experimental.go
|
||||||
@@ -19,15 +19,16 @@ type CacheFileOptions struct {
|
@@ -34,6 +34,7 @@ type ClashAPIOptions struct {
|
||||||
}
|
ExternalUIDownloadDetour string `json:"external_ui_download_detour,omitempty" reference:"outbound"`
|
||||||
|
Secret string `json:"secret,omitempty"`
|
||||||
type ClashAPIOptions struct {
|
DefaultMode string `json:"default_mode,omitempty"`
|
||||||
- ExternalController string `json:"external_controller,omitempty"`
|
|
||||||
- ExternalUI string `json:"external_ui,omitempty"`
|
|
||||||
- ExternalUIDownloadURL string `json:"external_ui_download_url,omitempty"`
|
|
||||||
- ExternalUIDownloadDetour string `json:"external_ui_download_detour,omitempty"`
|
|
||||||
- Secret string `json:"secret,omitempty"`
|
|
||||||
- DefaultMode string `json:"default_mode,omitempty"`
|
|
||||||
- ModeList []string `json:"-"`
|
|
||||||
- AccessControlAllowOrigin badoption.Listable[string] `json:"access_control_allow_origin,omitempty"`
|
|
||||||
- AccessControlAllowPrivateNetwork bool `json:"access_control_allow_private_network,omitempty"`
|
|
||||||
+ ExternalController string `json:"external_controller,omitempty"`
|
|
||||||
+ ExternalUI string `json:"external_ui,omitempty"`
|
|
||||||
+ ExternalUIDownloadURL string `json:"external_ui_download_url,omitempty"`
|
|
||||||
+ ExternalUIDownloadDetour string `json:"external_ui_download_detour,omitempty"`
|
|
||||||
+ Secret string `json:"secret,omitempty"`
|
|
||||||
+ DefaultMode string `json:"default_mode,omitempty"`
|
|
||||||
+ ProxyProviders []ClashProxyProviderOptions `json:"proxy_providers,omitempty"`
|
+ ProxyProviders []ClashProxyProviderOptions `json:"proxy_providers,omitempty"`
|
||||||
+ ModeList []string `json:"-"`
|
AccessControlAllowOrigin badoption.Listable[string] `json:"access_control_allow_origin,omitempty"`
|
||||||
+ AccessControlAllowOrigin badoption.Listable[string] `json:"access_control_allow_origin,omitempty"`
|
AccessControlAllowPrivateNetwork bool `json:"access_control_allow_private_network,omitempty"`
|
||||||
+ AccessControlAllowPrivateNetwork bool `json:"access_control_allow_private_network,omitempty"`
|
|
||||||
|
|
||||||
// Deprecated: migrated to global cache file
|
@@ -49,6 +50,23 @@ type ClashAPIOptions struct {
|
||||||
CacheFile string `json:"cache_file,omitempty"`
|
StoreFakeIP bool `json:"store_fakeip,omitempty" schema:"omit"`
|
||||||
@@ -41,6 +42,23 @@ type ClashAPIOptions struct {
|
|
||||||
StoreFakeIP bool `json:"store_fakeip,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+type ClashProxyProviderOptions struct {
|
+type ClashProxyProviderOptions struct {
|
||||||
|
|||||||
Reference in new issue
Block a user