mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-12-15 16:09:39 -05:00
VPN: Add method to retrieve wireguard private key
Signed-off-by: Malte Poll <mp@edgeless.systems>
This commit is contained in:
parent
e10a47f255
commit
0501d07f4a
3 changed files with 20 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ import (
|
|||
|
||||
type VPN interface {
|
||||
Setup(privKey []byte) ([]byte, error)
|
||||
GetPrivateKey() ([]byte, error)
|
||||
GetPublicKey(privKey []byte) ([]byte, error)
|
||||
GetInterfaceIP() (string, error)
|
||||
SetInterfaceIP(ip string) error
|
||||
|
|
@ -21,15 +22,21 @@ type VPN interface {
|
|||
type stubVPN struct {
|
||||
peers []stubVPNPeer
|
||||
interfaceIP string
|
||||
privateKey []byte
|
||||
addPeerErr error
|
||||
removePeerErr error
|
||||
getInterfaceIPErr error
|
||||
getPrivateKeyErr error
|
||||
}
|
||||
|
||||
func (*stubVPN) Setup(privKey []byte) ([]byte, error) {
|
||||
return []byte{2, 3, 4}, nil
|
||||
}
|
||||
|
||||
func (v *stubVPN) GetPrivateKey() ([]byte, error) {
|
||||
return v.privateKey, v.getPrivateKeyErr
|
||||
}
|
||||
|
||||
func (*stubVPN) GetPublicKey(privKey []byte) ([]byte, error) {
|
||||
if bytes.Equal(privKey, []byte{2, 3, 4}) {
|
||||
return []byte{3, 4, 5}, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue