Skip to content

Commit

Permalink
fix: test bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Feb 6, 2024
1 parent 8975ff7 commit d15e72d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions ray2sing/wireguard.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,21 @@ func WiregaurdSingbox(url string) (*T.Outbound, error) {
if pk, ok := u.Params["private_key"]; ok {
out.WireGuardOptions.PrivateKey = pk
}
if pk, ok := u.Params["privateKey"]; ok {
out.WireGuardOptions.PrivateKey = pk
}
if pub, ok := u.Params["peer_public_key"]; ok {
out.WireGuardOptions.PeerPublicKey = pub
}
if pub, ok := u.Params["peerPublicKey"]; ok {
out.WireGuardOptions.PeerPublicKey = pub
}
if psk, ok := u.Params["pre_shared_key"]; ok {
out.WireGuardOptions.PreSharedKey = psk
}
if psk, ok := u.Params["presharedKey"]; ok {
out.WireGuardOptions.PreSharedKey = psk
}

// Parse Workers
if workerStr, ok := u.Params["workers"]; ok {
Expand Down
2 changes: 1 addition & 1 deletion ray2sing_test/hysteria2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestHysteria2(t *testing.T) {
"outbounds": [
{
"type": "hysteria2",
"tag": " § 0",
"tag": "hysteria2 § 0",
"server": "example.com",
"server_port": 443,
"obfs": {
Expand Down
2 changes: 1 addition & 1 deletion ray2sing_test/ssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TestBase(t *testing.T) {
"outbounds": [
{
"type": "ssh",
"tag": " § 0",
"tag": "ssh § 0",
"server": "server",
"server_port": 22,
"user": "user",
Expand Down
4 changes: 2 additions & 2 deletions ray2sing_test/wiregaurd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (

func TestWiregaurd(t *testing.T) {

url := "wg://[server]:222/?pk=[private_key]&local_address=10.0.0.2/24&peer_pk=[peer_public_key]&pre_shared_key=[pre_shared_key]&workers=[workers]&mtu=[mtu]&reserved=0,0,0"
url := "wg://[server]:222/?pk=[private_key]&local_address=10.0.0.2/24&peer_public_key=[peer_public_key]&pre_shared_key=[pre_shared_key]&workers=[workers]&mtu=[mtu]&reserved=0,0,0"

// Define the expected JSON structure
expectedJSON := `
{
"outbounds": [
{
"type": "wireguard",
"tag": " § 0",
"tag": "wireguard § 0",
"local_address": "10.0.0.2/24",
"private_key": "[private_key]",
"server": "server",
Expand Down

0 comments on commit d15e72d

Please sign in to comment.