Skip to content

Commit

Permalink
function name change clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Williams committed Aug 4, 2020
1 parent 2c5e714 commit 582ed8e
Show file tree
Hide file tree
Showing 14 changed files with 72 additions and 72 deletions.
4 changes: 2 additions & 2 deletions v2/examples/spiffe-grpc/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func main() {
// Allowed SPIFFE ID
serverID := spiffeid.Must("example.org", "server")

localHooks := tlsconfig.Trace{
localTrace := tlsconfig.Trace{
GetTLSCertificateStart: func(tlsconfig.GetTLSCertificate) {
log.Printf("got start of GetTLSCertificate\n")
},
Expand All @@ -40,7 +40,7 @@ func main() {
}

// Create a `tls.Config` to allow mTLS connections, and verify that presented certificate has SPIFFE ID `spiffe://example.org/server`
tlsConfig := tlsconfig.MTLSClientConfig(source, source, tlsconfig.AuthorizeID(serverID), localHooks)
tlsConfig := tlsconfig.MTLSClientConfig(source, source, tlsconfig.AuthorizeID(serverID), localTrace)
conn, err := grpc.DialContext(ctx, "localhost:50051", grpc.WithTransportCredentials(credentials.NewTLS(tlsConfig)))
if err != nil {
log.Fatalf("Error creating dial: %v", err)
Expand Down
4 changes: 2 additions & 2 deletions v2/examples/spiffe-grpc/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func main() {
// Allowed SPIFFE ID
clientID := spiffeid.Must("example.org", "client")

localHooks := tlsconfig.Trace{
localTrace := tlsconfig.Trace{
GetTLSCertificateStart: func(tlsconfig.GetTLSCertificate) {
log.Printf("got start of GetTLSCertificate\n")
},
Expand All @@ -51,7 +51,7 @@ func main() {
}

// Create a `tls.Config` to allow mTLS connections, and verify that presented certificate has SPIFFE ID `spiffe://example.org/client`
tlsConfig := tlsconfig.MTLSServerConfig(source, source, tlsconfig.AuthorizeID(clientID), localHooks)
tlsConfig := tlsconfig.MTLSServerConfig(source, source, tlsconfig.AuthorizeID(clientID), localTrace)
s := grpc.NewServer(grpc.Creds(credentials.NewTLS(tlsConfig)))

lis, err := net.Listen("tcp", "127.0.0.1:50051")
Expand Down
4 changes: 2 additions & 2 deletions v2/examples/spiffe-http/client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func main() {
// Allowed SPIFFE ID
serverID := spiffeid.Must("example.org", "server")

localHooks := tlsconfig.Trace{
localTrace := tlsconfig.Trace{
GetTLSCertificateStart: func(tlsconfig.GetTLSCertificate) {
log.Printf("got start of GetTLSCertificate\n")
},
Expand All @@ -42,7 +42,7 @@ func main() {
}

// Create a `tls.Config` to allow mTLS connections, and verify that presented certificate has SPIFFE ID `spiffe://example.org/server`
tlsConfig := tlsconfig.MTLSClientConfig(source, source, tlsconfig.AuthorizeID(serverID), localHooks)
tlsConfig := tlsconfig.MTLSClientConfig(source, source, tlsconfig.AuthorizeID(serverID), localTrace)
client := &http.Client{
Transport: &http.Transport{
TLSClientConfig: tlsConfig,
Expand Down
4 changes: 2 additions & 2 deletions v2/examples/spiffe-http/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func main() {
// Allowed SPIFFE ID
clientID := spiffeid.Must("example.org", "client")

localHooks := tlsconfig.Trace{
localTrace := tlsconfig.Trace{
GetTLSCertificateStart: func(tlsconfig.GetTLSCertificate) {
log.Printf("got start of GetTLSCertificate\n")
},
Expand All @@ -45,7 +45,7 @@ func main() {
}

// Create a `tls.Config` to allow mTLS connections, and verify that presented certificate has SPIFFE ID `spiffe://example.org/client`
tlsConfig := tlsconfig.MTLSServerConfig(source, source, tlsconfig.AuthorizeID(clientID), localHooks)
tlsConfig := tlsconfig.MTLSServerConfig(source, source, tlsconfig.AuthorizeID(clientID), localTrace)
server := &http.Server{
Addr: ":8443",
TLSConfig: tlsConfig,
Expand Down
4 changes: 2 additions & 2 deletions v2/examples/spiffe-jwt-using-proxy/proxy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func main() {

http.HandleFunc("/", handler(proxy))

localHooks := tlsconfig.Trace{
localTrace := tlsconfig.Trace{
GetTLSCertificateStart: func(tlsconfig.GetTLSCertificate) {
log.Printf("got start of GetTLSCertificate\n")
},
Expand All @@ -63,7 +63,7 @@ func main() {
// the clients.
server := &http.Server{
Addr: ":8443",
TLSConfig: tlsconfig.TLSServerConfig(x509Source, localHooks),
TLSConfig: tlsconfig.TLSServerConfig(x509Source, localTrace),
}
log.Fatal(server.ListenAndServeTLS("", ""))
}
Expand Down
4 changes: 2 additions & 2 deletions v2/examples/spiffe-jwt-using-proxy/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func main() {
}
http.Handle("/", auth.authenticateClient(http.HandlerFunc(index)))

localHooks := tlsconfig.Trace{
localTrace := tlsconfig.Trace{
GetTLSCertificateStart: func(tlsconfig.GetTLSCertificate) {
log.Printf("got start of GetTLSCertificate\n")
},
Expand All @@ -91,7 +91,7 @@ func main() {

server := &http.Server{
Addr: ":8080",
TLSConfig: tlsconfig.TLSServerConfig(x509Source, localHooks),
TLSConfig: tlsconfig.TLSServerConfig(x509Source, localTrace),
}
log.Fatal(server.ListenAndServeTLS("", ""))
}
4 changes: 2 additions & 2 deletions v2/examples/spiffe-jwt/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func main() {
}
defer x509Source.Close()

localHooks := tlsconfig.Trace{
localTrace := tlsconfig.Trace{
GetTLSCertificateStart: func(tlsconfig.GetTLSCertificate) {
log.Printf("got start of GetTLSCertificate\n")
},
Expand All @@ -75,7 +75,7 @@ func main() {
}

// Create a `tls.Config` with configuration to allow TLS communication with client
tlsConfig := tlsconfig.TLSServerConfig(x509Source, localHooks)
tlsConfig := tlsconfig.TLSServerConfig(x509Source, localTrace)
server := &http.Server{
Addr: ":8443",
TLSConfig: tlsConfig,
Expand Down
4 changes: 2 additions & 2 deletions v2/federation/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func ExampleHandler_sPIFFEAuth() {
}
defer bundleSource.Close()

localHooks := tlsconfig.Trace{
localTrace := tlsconfig.Trace{
GetTLSCertificateStart: func(tlsconfig.GetTLSCertificate) {
log.Printf("got start of GetTLSCertificate\n")
},
Expand All @@ -155,7 +155,7 @@ func ExampleHandler_sPIFFEAuth() {
server := http.Server{
Addr: ":8443",
Handler: federation.Handler(trustDomain, bundleSource, logger.Null),
TLSConfig: tlsconfig.TLSServerConfig(x509Source, localHooks),
TLSConfig: tlsconfig.TLSServerConfig(x509Source, localTrace),
}
if err := server.ListenAndServeTLS("", ""); err != nil {
// TODO: handle error
Expand Down
4 changes: 2 additions & 2 deletions v2/internal/test/fakebundleendpoint/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func WithTestBundles(bundles ...*spiffebundle.Bundle) ServerOption {
}

func WithSPIFFEAuth(bundle *spiffebundle.Bundle, svid *x509svid.SVID) ServerOption {
localHooks := tlsconfig.Trace{
localTrace := tlsconfig.Trace{
GetTLSCertificateStart: func(tlsconfig.GetTLSCertificate) {
fmt.Printf("got start of GetTLSCertificate\n")
},
Expand All @@ -138,7 +138,7 @@ func WithSPIFFEAuth(bundle *spiffebundle.Bundle, svid *x509svid.SVID) ServerOpti

return serverOption(func(s *Server) {
s.rootCAs = x509util.NewCertPool(bundle.X509Authorities())
s.tlscfg = tlsconfig.TLSServerConfig(svid, localHooks)
s.tlscfg = tlsconfig.TLSServerConfig(svid, localTrace)
})
}

Expand Down
4 changes: 2 additions & 2 deletions v2/spiffetls/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ func DialWithMode(ctx context.Context, network, addr string, mode DialMode, opti
case tlsClientMode:
tlsconfig.HookTLSClientConfig(tlsConfig, m.bundle, m.authorizer)
case mtlsClientMode:
tlsconfig.HookMTLSClientConfig(tlsConfig, m.svid, m.bundle, m.authorizer, opt.tlsConfigHooks)
tlsconfig.HookMTLSClientConfig(tlsConfig, m.svid, m.bundle, m.authorizer, opt.tlsConfigTrace)
case mtlsWebClientMode:
tlsconfig.HookMTLSWebClientConfig(tlsConfig, m.svid, m.roots, opt.tlsConfigHooks)
tlsconfig.HookMTLSWebClientConfig(tlsConfig, m.svid, m.roots, opt.tlsConfigTrace)
default:
return nil, spiffetlsErr.New("unknown client mode: %v", m.mode)
}
Expand Down
4 changes: 2 additions & 2 deletions v2/spiffetls/listen.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ func NewListenerWithMode(ctx context.Context, inner net.Listener, mode ListenMod

switch m.mode {
case tlsServerMode:
tlsconfig.HookTLSServerConfig(tlsConfig, m.svid, opt.tlsConfigHooks)
tlsconfig.HookTLSServerConfig(tlsConfig, m.svid, opt.tlsConfigTrace)
case mtlsServerMode:
tlsconfig.HookMTLSServerConfig(tlsConfig, m.svid, m.bundle, m.authorizer, opt.tlsConfigHooks)
tlsconfig.HookMTLSServerConfig(tlsConfig, m.svid, m.bundle, m.authorizer, opt.tlsConfigTrace)
case mtlsWebServerMode:
tlsconfig.HookMTLSWebServerConfig(tlsConfig, m.cert, m.bundle, m.authorizer)
default:
Expand Down
4 changes: 2 additions & 2 deletions v2/spiffetls/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ func (fn dialOption) apply(c *dialConfig) {
type dialConfig struct {
baseTLSConf *tls.Config
dialer *net.Dialer
tlsConfigHooks tlsconfig.Trace
tlsConfigTrace tlsconfig.Trace
}

type listenOption func(*listenConfig)

type listenConfig struct {
baseTLSConf *tls.Config
tlsConfigHooks tlsconfig.Trace
tlsConfigTrace tlsconfig.Trace
}

func (fn listenOption) apply(c *listenConfig) {
Expand Down
Loading

0 comments on commit 582ed8e

Please sign in to comment.