Documentation
¶
Index ¶
- type Peer
- func (p *Peer) Connect(opts ...grpc.DialOption) (err error)
- func (p *Peer) ExchangeKeys(force bool) (_ *rsa.PublicKey, err error)
- func (p *Peer) Info() PeerInfo
- func (p *Peer) SigningKey() *rsa.PublicKey
- func (p *Peer) String() string
- func (p *Peer) Transfer(in *api.SecureEnvelope) (out *api.SecureEnvelope, err error)
- func (p *Peer) UpdateSigningKey(key interface{}) error
- type PeerInfo
- type Peers
- func (p *Peers) Add(info *PeerInfo) (err error)
- func (p *Peers) Connect(opts ...grpc.DialOption) (err error)
- func (p *Peers) FromContext(ctx context.Context) (_ *Peer, err error)
- func (p *Peers) Get(commonName string) (*Peer, error)
- func (p *Peers) Lookup(commonName string) (peer *Peer, err error)
- func (p *Peers) Search(name string) (_ *Peer, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Peer ¶
Peer contains cached information about connections to other members of the TRISA network and facilitates directory service lookups and information exchanges. TODO: implement transfer stream and account confirmation endpoints.
func (*Peer) Connect ¶
func (p *Peer) Connect(opts ...grpc.DialOption) (err error)
Connect to the remote peer - thread safe.
func (*Peer) ExchangeKeys ¶
ExchangeKeys kicks of a key exchange with the remote peer. It locks to block multiple key exchanges from being issued and returns the key immediately if the key is already cached on the Peer (unless force is specified, then it will conduct a key exchange). This allows callers to ensure that they will get the public signing key when needed.
func (*Peer) SigningKey ¶
SigningKey returns the current signing key of the remote peer, if it's available (otherwise returns nil). If a key exchange is underway, this method blocks until a key has been retrieved from the remote peer.
func (*Peer) Transfer ¶
func (p *Peer) Transfer(in *api.SecureEnvelope) (out *api.SecureEnvelope, err error)
Transfer sends the unary RPC request via the peer client, ensuring its connected.
func (*Peer) UpdateSigningKey ¶
UpdateSigningKey if the key exchange was initiated from a remote TRISA peer.
type PeerInfo ¶
type PeerInfo struct { ID string RegisteredDirectory string CommonName string Endpoint string SigningKey *rsa.PublicKey }
PeerInfo contains directory service information that uniquely identifies the peer. It is maintained separately from the Peer to allow for thread-safe reads and simpler marshalling and unmarshalling of JSON data about the peer.
TODO: implement Marshaler and Unmarshaler to ensure signing key is base64 PEM encoded. TODO: allow different signing key types other than just RSA
type Peers ¶
Peers manages TRISA network connections to send requests to other TRISA nodes.
func (*Peers) Connect ¶
func (p *Peers) Connect(opts ...grpc.DialOption) (err error)
Connect to the remote peer - thread safe.
func (*Peers) FromContext ¶
FromContext looks up the TLSInfo from the incoming gRPC connection to get the common name of the Peer from the certificate. If the Peer is already in the cache, it returns the peer information, otherwise it creates and caches the Peer info.
func (*Peers) Get ¶
Get a cached peer by common name, creating it if necessary. Getting the Peer does not necessarily guarantee the peer with the common name exists