-
Notifications
You must be signed in to change notification settings - Fork 728
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize change proxy Remake desktop Optimize lots of details
- Loading branch information
Showing
86 changed files
with
5,146 additions
and
2,041 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Submodule Clash.Meta
updated
5 files
+4 −0 | adapter/adapter.go | |
+5 −0 | adapter/patch.go | |
+0 −3 | adapter/provider/healthcheck.go | |
+0 −4 | adapter/provider/patch.go | |
+1 −8 | hub/route/server.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
) | ||
|
||
const ( | ||
messageMethod Method = "message" | ||
initClashMethod Method = "initClash" | ||
getIsInitMethod Method = "getIsInit" | ||
forceGcMethod Method = "forceGc" | ||
shutdownMethod Method = "shutdown" | ||
validateConfigMethod Method = "validateConfig" | ||
updateConfigMethod Method = "updateConfig" | ||
getProxiesMethod Method = "getProxies" | ||
changeProxyMethod Method = "changeProxy" | ||
getTrafficMethod Method = "getTraffic" | ||
getTotalTrafficMethod Method = "getTotalTraffic" | ||
resetTrafficMethod Method = "resetTraffic" | ||
asyncTestDelayMethod Method = "asyncTestDelay" | ||
getConnectionsMethod Method = "getConnections" | ||
closeConnectionsMethod Method = "closeConnections" | ||
closeConnectionMethod Method = "closeConnection" | ||
getExternalProvidersMethod Method = "getExternalProviders" | ||
getExternalProviderMethod Method = "getExternalProvider" | ||
updateGeoDataMethod Method = "updateGeoData" | ||
updateExternalProviderMethod Method = "updateExternalProvider" | ||
sideLoadExternalProviderMethod Method = "sideLoadExternalProvider" | ||
startLogMethod Method = "startLog" | ||
stopLogMethod Method = "stopLog" | ||
startListenerMethod Method = "startListener" | ||
stopListenerMethod Method = "stopListener" | ||
) | ||
|
||
type Method string | ||
|
||
type Action struct { | ||
Id string `json:"id"` | ||
Method Method `json:"method"` | ||
Data interface{} `json:"data"` | ||
} | ||
|
||
func (action Action) Json() ([]byte, error) { | ||
data, err := json.Marshal(action) | ||
return data, err | ||
} | ||
|
||
func (action Action) callback(data interface{}) bool { | ||
if conn == nil { | ||
return false | ||
} | ||
sendAction := Action{ | ||
Id: action.Id, | ||
Method: action.Method, | ||
Data: data, | ||
} | ||
res, err := sendAction.Json() | ||
if err != nil { | ||
return false | ||
} | ||
_, err = conn.Write(append(res, []byte("\n")...)) | ||
if err != nil { | ||
return false | ||
} | ||
return true | ||
} |
Oops, something went wrong.