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

Api: Add uptream_address to proxy config #534

Closed
wants to merge 3 commits into from

Conversation

nezdolik
Copy link

Signed-off-by: Kateryna Nezdolii [email protected]

What type of PR is this?
feature

What this PR does / Why we need it:
Adds possibility to configure Quilkin with upstream address to bind to when proxying packets upstream.

Which issue(s) this PR fixes:
Closes #345

@@ -134,8 +136,11 @@ impl SessionArgs {
impl Session {
/// internal constructor for a Session from SessionArgs
async fn new(args: SessionArgs) -> Result<Self> {
let addr = (std::net::Ipv4Addr::UNSPECIFIED, 0);
let socket = Arc::new(UdpSocket::bind(addr).await.map_err(Error::BindUdpSocket)?);
let socket = Arc::new(
Copy link
Contributor

@markmandel markmandel May 20, 2022

Choose a reason for hiding this comment

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

Won't this fail if you end up with more than one session (or endpoint)? Since each session will attempt to bind to the same port, and will then fail, and no session will be bound.

I'm not quite sure this will work 🤔 Maybe each endpoint you could be able to specify the port?

The proxy is built to be non-transparent, so Sessions do use unique sender and receiver information as it's storage for individual Sessions:

type SessionsMap = HashMap<SessionKey, Session>;
type Sessions = Arc<RwLock<SessionsMap>>;

Breaking that contract could have some unintended consequences as well.

I would also advocate that there is some integration tests for this to ensure it works as expected.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just reviewing @XAMPPRocky 's original comment

Rather than bind a new port on each session, we probably need to do something more like having an Option<Arc<UdpSocker>> that gets passed into the Session, and if it's None then we bind to the ephemeral port.

Still not quite sure how/if that solves the unique key issue within SessionManager though 🤔 I'll write some thoughts on the original PR for some design discussion.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for review @markmandel, good catch. Tested on live Quilkin process but with one session. That should de definitely covered in integration test. Looking forward to design discussions, meanwhile will pause dev work on this.

@markmandel
Copy link
Contributor

If you rebase against upstream/main that will fix the documentation 404 error.

@quilkin-bot
Copy link
Collaborator

Build Succeeded 🥳

Build Id: 0362826b-7124-4a54-880a-10797624162d

To build this version:

git fetch [email protected]:googleforgames/quilkin.git pull/534/head:pr_534 && git checkout pr_534
cargo build

@markmandel
Copy link
Contributor

Shall we close this PR, until the details of this issue are worked out in #345? (which is also a gentle bump to take another look at the suggestions in that ticket 😄 )

@nezdolik
Copy link
Author

nezdolik commented Jun 8, 2022

@markmandel makes sense, closing.

@nezdolik nezdolik closed this Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bind Quilkin's sender socket to a given address:port
3 participants