new: add CommandGroupInfoOnly

This commit is contained in:
Hiddify
2024-02-06 11:14:32 +01:00
parent 4dd7c6a2de
commit 2c1731cbd0

View File

@@ -6,8 +6,9 @@ import (
) )
var ( var (
statusClient *libbox.CommandClient statusClient *libbox.CommandClient
groupClient *libbox.CommandClient groupClient *libbox.CommandClient
groupInfoOnlyClient *libbox.CommandClient
) )
func StartCommand(command int32, port int64, logFactory log.Factory) error { func StartCommand(command int32, port int64, logFactory log.Factory) error {
@@ -32,10 +33,22 @@ func StartCommand(command int32, port int64, logFactory log.Factory) error {
}, },
&libbox.CommandClientOptions{ &libbox.CommandClientOptions{
Command: libbox.CommandGroup, Command: libbox.CommandGroup,
StatusInterval: 1000000000, StatusInterval: 30,
}, },
) )
return groupClient.Connect() return groupClient.Connect()
case libbox.CommandGroupInfoOnly:
groupInfoOnlyClient = libbox.NewCommandClient(
&CommandClientHandler{
port: port,
logger: logFactory.NewLogger("[GroupInfoOnly Command Client]"),
},
&libbox.CommandClientOptions{
Command: libbox.CommandGroupInfoOnly,
StatusInterval: 10,
},
)
return groupInfoOnlyClient.Connect()
} }
return nil return nil
} }
@@ -50,6 +63,10 @@ func StopCommand(command int32) error {
err := groupClient.Disconnect() err := groupClient.Disconnect()
groupClient = nil groupClient = nil
return err return err
case libbox.CommandGroupInfoOnly:
err := groupInfoOnlyClient.Disconnect()
groupInfoOnlyClient = nil
return err
} }
return nil return nil
} }