peer: save PublicIP instead of publicEndpoint / add multi-coord gRPCs

This commit is contained in:
Benedict 2022-04-13 12:39:55 +02:00 committed by Benedict Schlüter
parent 55a1aa783f
commit f0e35a43d4
31 changed files with 1216 additions and 666 deletions

View file

@ -6,22 +6,16 @@ import (
"github.com/edgelesssys/constellation/coordinator/vpnapi/vpnproto"
)
// AdminData contains all VPN information about the admin.
type AdminData struct {
VPNIP string
PublicKey []byte
}
// Peer holds all information about a peer.
type Peer struct {
// PublicEndpoint is the endpoint on which the peer is reachable.
PublicEndpoint string
// PublicIP is the public IP address on which the peer is reachable.
PublicIP string
// VPNIP holds the internal VPN address, can only be used within the VPN
// and some gRPC services may only be reachable from this IP.
VPNIP string
// VPNPubKey contains the PublicKey used for cryptographic purposes in the VPN.
VPNPubKey []byte
// Role is the peer's role (Coordinator or Node).
// Role is the peer's role (Coordinator, Node or Admin).
Role role.Role
}
@ -29,10 +23,10 @@ func FromPubProto(peers []*pubproto.Peer) []Peer {
var result []Peer
for _, p := range peers {
result = append(result, Peer{
PublicEndpoint: p.PublicEndpoint,
VPNIP: p.VpnIp,
VPNPubKey: p.VpnPubKey,
Role: role.Role(p.Role),
PublicIP: p.PublicIp,
VPNIP: p.VpnIp,
VPNPubKey: p.VpnPubKey,
Role: role.Role(p.Role),
})
}
return result
@ -42,10 +36,10 @@ func ToPubProto(peers []Peer) []*pubproto.Peer {
var result []*pubproto.Peer
for _, p := range peers {
result = append(result, &pubproto.Peer{
PublicEndpoint: p.PublicEndpoint,
VpnIp: p.VPNIP,
VpnPubKey: p.VPNPubKey,
Role: uint32(p.Role),
PublicIp: p.PublicIP,
VpnIp: p.VPNIP,
VpnPubKey: p.VPNPubKey,
Role: uint32(p.Role),
})
}
return result
@ -55,10 +49,10 @@ func FromVPNProto(peers []*vpnproto.Peer) []Peer {
var result []Peer
for _, p := range peers {
result = append(result, Peer{
PublicEndpoint: p.PublicEndpoint,
VPNIP: p.VpnIp,
VPNPubKey: p.VpnPubKey,
Role: role.Role(p.Role),
PublicIP: p.PublicIp,
VPNIP: p.VpnIp,
VPNPubKey: p.VpnPubKey,
Role: role.Role(p.Role),
})
}
return result
@ -68,10 +62,10 @@ func ToVPNProto(peers []Peer) []*vpnproto.Peer {
var result []*vpnproto.Peer
for _, p := range peers {
result = append(result, &vpnproto.Peer{
PublicEndpoint: p.PublicEndpoint,
VpnIp: p.VPNIP,
VpnPubKey: p.VPNPubKey,
Role: uint32(p.Role),
PublicIp: p.PublicIP,
VpnIp: p.VPNIP,
VpnPubKey: p.VPNPubKey,
Role: uint32(p.Role),
})
}
return result