Skip to content
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

Merged
merged 4 commits into from Apr 13, 2022

Conversation

amartinezfayo
Copy link
Member

  • Add support to Workload API endpoints exposed over named pipes in Windows through the introduction of the WithNamedPipeName option, available on Windows only.
  • Consumers of this library from other platforms will not notice any change.

…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>
Copy link
Member

@azdagron azdagron left a 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)
Copy link
Member

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.

// parseTargetFromNamedPipeName parses the named pipe name
// for the endpoint address and returns the target string
// suitable for dialing.
func parseTargetFromNamedPipeName(pipeName string) string {
Copy link
Member

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())
Copy link
Member

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?

Copy link
Member Author

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>
Copy link
Member

@azdagron azdagron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/

@amartinezfayo amartinezfayo merged commit 6fd5a8f into spiffe:main Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants