add warp in warp & reserved & more more

This commit is contained in:
Hiddify
2024-05-31 13:08:55 +02:00
parent 0bbd581277
commit bc48ec07a8
19 changed files with 288 additions and 263 deletions

View File

@@ -213,6 +213,12 @@ func ChangeConfigOptions(in *pb.ChangeConfigOptionsRequest) (*pb.CoreInfoRespons
return nil, err
}
}
if configOptions.Warp2.WireguardConfigStr != "" {
err := json.Unmarshal([]byte(configOptions.Warp2.WireguardConfigStr), &configOptions.Warp2.WireguardConfig)
if err != nil {
return nil, err
}
}
return &pb.CoreInfoResponse{}, nil
}
func (s *CoreService) GenerateConfig(ctx context.Context, in *pb.GenerateConfigRequest) (*pb.GenerateConfigResponse, error) {

View File

@@ -11,7 +11,7 @@ import (
func main() {
// defer C.free(unsafe.Pointer(port))
v2.StartGrpcServer("127.0.0.1:50051")
v2.StartGrpcServer("127.0.0.1:50051", "hello")
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
<-sigChan

View File

@@ -239,6 +239,11 @@ func readConfigOptionsAt(path string) (*config.ConfigOptions, error) {
return nil, err
}
}
if options.Warp2.WireguardConfigStr != "" {
err := json.Unmarshal([]byte(options.Warp2.WireguardConfigStr), &options.Warp2.WireguardConfig)
if err != nil {
return nil, err
}
}
return &options, nil
}

View File

@@ -25,6 +25,7 @@ func GenerateWarpConfig(in *pb.GenerateWarpConfigRequest) (*pb.WarpGenerationRes
LocalAddressIpv4: wg.LocalAddressIPv4,
LocalAddressIpv6: wg.LocalAddressIPv6,
PeerPublicKey: wg.PeerPublicKey,
ClientId: wg.ClientID,
},
Log: log,
}, nil