d7f3bcc8bb
AuthorizeIntentionTarget is a generalized version of the old function, and can be evaluated against sources or destinations.
27 lines
555 B
Go
27 lines
555 B
Go
package connect
|
|
|
|
import (
|
|
"fmt"
|
|
"net/url"
|
|
)
|
|
|
|
// SpiffeIDService is the structure to represent the SPIFFE ID for an agent.
|
|
type SpiffeIDAgent struct {
|
|
Host string
|
|
Datacenter string
|
|
Agent string
|
|
}
|
|
|
|
// URI returns the *url.URL for this SPIFFE ID.
|
|
func (id *SpiffeIDAgent) URI() *url.URL {
|
|
var result url.URL
|
|
result.Scheme = "spiffe"
|
|
result.Host = id.Host
|
|
result.Path = fmt.Sprintf("/agent/client/dc/%s/id/%s", id.Datacenter, id.Agent)
|
|
return &result
|
|
}
|
|
|
|
func (id *SpiffeIDAgent) CommonName() string {
|
|
return AgentCN(id.Agent, id.Host)
|
|
}
|