mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
Add wireguard test
This commit is contained in:
parent
bbf25b14d9
commit
075051a693
2 changed files with 128 additions and 4 deletions
|
@ -22,14 +22,14 @@ func (c *WireGuardPeerConfig) Build() (proto.Message, error) {
|
|||
config := new(wireguard.PeerConfig)
|
||||
|
||||
if c.PublicKey != "" {
|
||||
config.PublicKey, err = parseWireGuardKey(c.PublicKey)
|
||||
config.PublicKey, err = ParseWireGuardKey(c.PublicKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if c.PreSharedKey != "" {
|
||||
config.PreSharedKey, err = parseWireGuardKey(c.PreSharedKey)
|
||||
config.PreSharedKey, err = ParseWireGuardKey(c.PreSharedKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ func (c *WireGuardConfig) Build() (proto.Message, error) {
|
|||
config := new(wireguard.DeviceConfig)
|
||||
|
||||
var err error
|
||||
config.SecretKey, err = parseWireGuardKey(c.SecretKey)
|
||||
config.SecretKey, err = ParseWireGuardKey(c.SecretKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ func (c *WireGuardConfig) Build() (proto.Message, error) {
|
|||
return config, nil
|
||||
}
|
||||
|
||||
func parseWireGuardKey(str string) (string, error) {
|
||||
func ParseWireGuardKey(str string) (string, error) {
|
||||
var err error
|
||||
|
||||
if len(str)%2 == 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue