-
Notifications
You must be signed in to change notification settings - Fork 60
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 20, 2024
1 parent
c70e3b9
commit a0e09ea
Showing
47 changed files
with
1,276 additions
and
8,327 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 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 |
---|---|---|
@@ -1,32 +1,41 @@ | ||
package cmd | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"context" | ||
"log" | ||
"time" | ||
|
||
"github.com/hiddify/hiddify-core/v2/config" | ||
"github.com/hiddify/hiddify-core/v2/hcommon" | ||
hcore "github.com/hiddify/hiddify-core/v2/hcore" | ||
"google.golang.org/grpc" | ||
) | ||
|
||
// "github.com/hiddify/hiddify-core/extension_repository/cleanip_scanner" | ||
"github.com/spf13/cobra" | ||
const ( | ||
address = "localhost:17078" | ||
defaultName = "world" | ||
) | ||
|
||
var commandTemp = &cobra.Command{ | ||
Use: "temp", | ||
Short: "temp", | ||
Args: cobra.MaximumNArgs(2), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
// fmt.Printf("Ping time: %d ms\n", Ping()) | ||
tmp := map[string][]string{ | ||
"direct-dns-address": {"1.1.1.1"}, | ||
"tls-tricks.enable-fragment": {"true"}, | ||
"tls-tricks.fragment-size": {"2-4"}, | ||
func init() { | ||
conn, err := grpc.Dial(address, grpc.WithInsecure()) | ||
if err != nil { | ||
log.Fatalf("did not connect: %v", err) | ||
} | ||
defer conn.Close() | ||
c := hcore.NewCoreClient(conn) | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) | ||
defer cancel() | ||
|
||
// SayHello | ||
stream, err := c.OutboundsInfo(ctx, &hcommon.Empty{}) | ||
|
||
for { | ||
r, err := stream.Recv() | ||
if err != nil { | ||
log.Fatalf("could not receive: %v", err) | ||
} | ||
h := config.GetOverridableHiddifyOptions(tmp) | ||
j, _ := json.Marshal(h) | ||
fmt.Println(string(j)) | ||
}, | ||
} | ||
log.Printf("Received1: %s", r.String()) | ||
|
||
func init() { | ||
mainCommand.AddCommand(commandTemp) | ||
time.Sleep(1 * time.Second) | ||
} | ||
} |
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
Oops, something went wrong.