Skip to content

Commit

Permalink
Merge pull request #398 from evan2645/expose-server-svid
Browse files Browse the repository at this point in the history
Expose the server's SVID via endpoints package
  • Loading branch information
evan2645 authored Mar 21, 2018
2 parents 683f87f + 16eb252 commit dbd7d96
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/server/endpoints/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ type Server interface {
// ListenAndServe will unblock with `nil` if/when shutdown completes
// cleanly
Shutdown()

// SVID returns the server's SVID and private key
SVID() (*x509.Certificate, *ecdsa.PrivateKey)
}

type endpoints struct {
Expand Down Expand Up @@ -79,6 +82,14 @@ func (e *endpoints) Shutdown() {
return
}

// SVID returns the server's SVID and private key
func (e *endpoints) SVID() (*x509.Certificate, *ecdsa.PrivateKey) {
e.mtx.RLock()
defer e.mtx.RUnlock()

return e.svid, e.svidKey
}

// listenAndServe creates listeners and starts all servers. It serves
// as the top-most tomb routine.
func (e *endpoints) listenAndServe() error {
Expand Down

0 comments on commit dbd7d96

Please sign in to comment.