-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
x
committed
Oct 19, 2024
1 parent
a9b3950
commit c70e3b9
Showing
10 changed files
with
74 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
go mod tidy | ||
TAGS=with_gvisor,with_quic,with_wireguard,with_ech,with_utls,with_clash_api,with_grpc | ||
# TAGS=with_dhcp,with_low_memory,with_conntrack | ||
go run --tags $TAGS ./cli $@ | ||
go run --tags $TAGS ./cmd/main $@ |
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 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 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 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 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 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,44 @@ | ||
package hcore | ||
|
||
import ( | ||
"github.com/sagernet/sing-box/experimental/libbox" | ||
) | ||
|
||
var commandServer *libbox.CommandServer | ||
|
||
type CommandServerHandler struct{} | ||
|
||
func (csh *CommandServerHandler) ServiceReload() error { | ||
Log(LogLevel_DEBUG, LogType_CORE, "Reloading service") | ||
|
||
Stop() | ||
_, err := StartService(&StartRequest{ | ||
EnableOldCommandServer: true, | ||
DelayStart: true, | ||
}, nil) | ||
return err | ||
} | ||
|
||
func (csh *CommandServerHandler) GetSystemProxyStatus() *libbox.SystemProxyStatus { | ||
Log(LogLevel_DEBUG, LogType_CORE, "Getting system proxy status") | ||
return &libbox.SystemProxyStatus{Available: true, Enabled: false} | ||
} | ||
|
||
func (csh *CommandServerHandler) SetSystemProxyEnabled(isEnabled bool) error { | ||
Log(LogLevel_DEBUG, LogType_CORE, "Setting system proxy status, enabled? ", isEnabled) | ||
return csh.ServiceReload() | ||
} | ||
|
||
func (csh *CommandServerHandler) PostServiceClose() { | ||
if commandServer != nil { | ||
commandServer.Close() | ||
commandServer.SetService(nil) | ||
} | ||
commandServer = nil | ||
} | ||
|
||
func startCommandServer(sbox *libbox.BoxService) error { | ||
commandServer = libbox.NewCommandServer(&CommandServerHandler{}, 300) | ||
commandServer.SetService(sbox) | ||
return commandServer.Start() | ||
} |
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 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 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