Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WireGuard PreSharedKey in UI #3512

Closed
titancomputer opened this issue Aug 23, 2024 · 3 comments · Fixed by #3989
Closed

Add WireGuard PreSharedKey in UI #3512

titancomputer opened this issue Aug 23, 2024 · 3 comments · Fixed by #3989

Comments

@titancomputer
Copy link

titancomputer commented Aug 23, 2024

Hello

I'm Talking About A Wireguard Config File Like This :

[Interface]
PrivateKey = 6AJWDDOYXMOamJ6SaXt03V4tnIpCQcADdS/NjBQAJkQ=
Address = 10.66.66.6/32,fd42:42:42::6/128
DNS = 1.1.1.1,1.0.0.1

[Peer]
PublicKey = uHpbdcEvqslm70pxNaaxMGHzy5LC2h1QoENstML4Y0Q=
PresharedKey = f7HdycIK1A8rOm8aD3IluF6xVFb5HRQ4nOl9kN7Tf7o=
Endpoint = xxx.xxx.xxx.xxx:51820
AllowedIPs = 0.0.0.0/0,::/0

As You Know, We Have Three Key Parameters In Wireguard Config Files Which Two Of Them Are Mandatory (PrivateKey & PublicKey) And Another Key Which Known As PresharedKey Is Optional.
But If The Provider Tells You A PresharedKey In It's Config, You Must Set It On Your's Or You Can't Use It!

Since You Have Added The Wireguard Support So Far, And Xray Core Supports PresharedKey As JSON Config With This Codes :

"publicKey": "uHpbdcEvqslm70pxNaaxMGHzy5LC2h1QoENstML4Y0Q=",
"preSharedKey": "f7HdycIK1A8rOm8aD3IluF6xVFb5HRQ4nOl9kN7Tf7o="
          }
        ],
"secretKey": "6AJWDDOYXMOamJ6SaXt03V4tnIpCQcADdS/NjBQAJkQ="

And You Didn't Make A Field On Wireguard Config Setup In UI , All Of Users With These Types Of Configs Had To Use It With JSON Custom Config And It Makes Difficulties.

Please Add A Field After PublicKey And Before Reserved For PreSharedKey (Optional) Parameter. (Default = Empty)

P.S. : 3x-ui Panel Already Supports Wireguard with PreSharedKey.

Best Regards

@CodeWithTamim
Copy link
Contributor

Soon

@titancomputer
Copy link
Author

@CodeWithTamim any updates?

@CodeWithTamim
Copy link
Contributor

@CodeWithTamim any updates?

working on it will pr soon

CodeWithTamim added a commit to CodeWithTamim/v2rayNG that referenced this issue Nov 19, 2024
Add support for preSharedKey in WireGuard configurations and fix the parsing function to correctly handle all necessary fields.

Previously, the application did not support the optional preSharedKey parameter in WireGuard config files, forcing users to rely on JSON custom configurations. This update introduces a dedicated field for preSharedKey in the UI, aligning with Xray Core's support and simplifying the setup process for users.

Changes include:
- Added `preSharedKey` field in the WireGuard UI configuration.
- Updated `parseWireguardConfFile` function to correctly parse `PrivateKey`, `PublicKey`, and `preSharedKey`.
- Ensured `preSharedKey` is optional and handled gracefully when absent.
- Updated `toOutbound` method to include `preSharedKey` in the outbound configuration.
- Set `remarks` to the current Unix time during parsing.

Tested with the following configuration:
```[Interface]
Address = 192.168.6.66/32
DNS = 1.1.1.1,8.8.8.8
PrivateKey = eD/6cpJQaEeDH05AMeFyN3KSLLX+7YFR+MYRdgPDQ3Y=
[Peer]
publickey=/HS7r3waPuU7tTBLd2FlBhC+VROpJ5bwh5XXxuOoKFs=
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = sg3.vpnjantit.com:1024
```
Resolves 2dust#3512
@2dust 2dust closed this as completed in 9b4cc20 Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants