-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Named Pipes in Windows #190
Conversation
…s only) Signed-off-by: Agustín Martínez Fayó <amartinezfayo@gmail.com>
…s only) Signed-off-by: Agustín Martínez Fayó <amartinezfayo@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just a few nits.
jwtBundlesChans: make(map[chan *workload.JWTBundlesResponse]struct{}), | ||
} | ||
|
||
listener, err := winio.ListenPipe(fmt.Sprintf(`\\.\pipe\go-spiffe-test-pipe-%x`, rand.Uint64()), nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: If we don't seed rand, then two test processes running concurrently could collide on the names :) We're more than likely ok, but just thought I'd point it out just in case.
v2/workloadapi/client_windows.go
Outdated
// parseTargetFromNamedPipeName parses the named pipe name | ||
// for the endpoint address and returns the target string | ||
// suitable for dialing. | ||
func parseTargetFromNamedPipeName(pipeName string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "parse" implies the provided arguments are being parsed, which isn't the case here. maybe rename to namedPipeTarget
or makeNamedPipeTarget
or something?
Signed-off-by: Agustín Martínez Fayó <amartinezfayo@gmail.com>
@@ -20,6 +21,7 @@ func NewWithNamedPipeListener(tb testing.TB) *WorkloadAPI { | |||
jwtBundlesChans: make(map[chan *workload.JWTBundlesResponse]struct{}), | |||
} | |||
|
|||
rand.Seed(time.Now().UnixNano()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do this at package init time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
Signed-off-by: Agustín Martínez Fayó <amartinezfayo@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\o/
WithNamedPipeName
option, available on Windows only.