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

Update UDS example with socket paths determined at runtime #1611

Open
kriswuollett opened this issue Jan 30, 2024 · 0 comments · May be fixed by #1613
Open

Update UDS example with socket paths determined at runtime #1611

kriswuollett opened this issue Jan 30, 2024 · 0 comments · May be fixed by #1613

Comments

@kriswuollett
Copy link

Feature Request

Motivation

Workaround and Rust education for closure capture requirement that currently only a static path is used:

// We will ignore this uri because uds do not use it
// if your connector does use the uri it will be provided
// as the request to the `MakeConnection`.
let channel = Endpoint::try_from("http://[::]:50051")?
.connect_with_connector(service_fn(|_: Uri| {
let path = "/tmp/tonic/helloworld";
// Connect to a Uds socket
UnixStream::connect(path)
}))
.await?;
let mut client = GreeterClient::new(channel);

Proposal

Use the ustr crate to remove reliance on only a static hard-coded path.

kriswuollett added a commit to kriswuollett/tonic that referenced this issue Jan 30, 2024
Update unix domain socket examples to show configurable paths. It
demonstrates a way of configuring the UDS client using the ustr crate to
meet the closure capture requirements of the connector service_fn.

Fixes: hyperium#1611
Refs: hyperium#1612
@kriswuollett kriswuollett linked a pull request Jan 30, 2024 that will close this issue
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 a pull request may close this issue.

1 participant