Skip to content

How do I actually practically connect to a vsock? #4686

Closed Answered by kanpov
kanpov asked this question in Q&A
Discussion options

You must be logged in to vote

I figured out how to do this: I basically made my own tower service where I do this when creating a connection:

  1. Create a tokio::net::UnixStream like normal
  2. Write the plaintext CONNECT command to the stream and flush it
  3. Read the next line (OK ...) to determine if the tunnel was established and move past the CONNECT and OK lines
  4. Pass the UnixStream further so that hyper can use it

I'm currently making a hyper-sockets crate where I'll share my implementation.

Even so, this is remarkably hard to do!

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by kanpov
Comment options

You must be logged in to vote
1 reply
@kanpov
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants