hvpn-node3/proto/conv.go

21 lines
455 B
Go

package proto
import (
"net/url"
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
)
func WgPeerToPeer(peer wgtypes.Peer) Peer {
return Peer{
PublicKey: peer.PublicKey.String(),
PublicKeyUrlSafe: url.QueryEscape(peer.PublicKey.String()),
MTU: 1380,
TX: peer.TransmitBytes,
RX: peer.ReceiveBytes,
AllowedIPs: peer.AllowedIPs[0].IP,
PersistentKeepalive: peer.PersistentKeepaliveInterval,
}
}