Skip to content

chore(vpn): upsert agents with their network status #15659

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

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Nov 26, 2024

Closes #14734.

  • Each outgoing agent upsertion also includes the timestamp of the last wireguard handshake.
  • Agent upsertions will be created, for existing agents, with an updated last handshake time on a regular, fixed, interval of 10 seconds.

Copy link
Member Author

ethanndickson commented Nov 26, 2024

@ethanndickson ethanndickson force-pushed the ethan/vpn-agents-netstatus branch from cf43bdd to 594fbc6 Compare November 26, 2024 02:36
@ethanndickson ethanndickson marked this pull request as ready for review November 26, 2024 02:46
@ethanndickson ethanndickson requested review from deansheather, johnstcn and spikecurtis and removed request for johnstcn and spikecurtis November 26, 2024 02:46
@ethanndickson ethanndickson force-pushed the ethan/vpn-agents-netstatus branch from 594fbc6 to 1347916 Compare November 27, 2024 01:52
vpn/tunnel.go Outdated
resp.Msg = &TunnelMessage_PeerUpdate{
PeerUpdate: convertWorkspaceUpdate(state),
PeerUpdate: update,
Copy link
Member

Choose a reason for hiding this comment

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

Is it OK to send a nil PeerUpdate in the response?

Copy link
Member Author

@ethanndickson ethanndickson Dec 2, 2024

Choose a reason for hiding this comment

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

Good catch, I don't think we should.

For pushed updates, if there's no active connection (for whatever reason, should be impossible once the tunnel has started), we'll just send a nil last handshake time.

For requested updates, I think we have to send a nil PeerUpdate if we can't call CurentWorkspaceState.

@ethanndickson ethanndickson force-pushed the ethan/vpn-agents-netstatus branch from d150a25 to a456281 Compare December 3, 2024 03:17
@@ -175,8 +175,6 @@ linters-settings:
- name: modifies-value-receiver
- name: package-comments
- name: range
- name: range-val-address
- name: range-val-in-closure
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -238,7 +241,6 @@ linters:
- errname
- errorlint
- exhaustruct
- exportloopref
Copy link
Member Author

Choose a reason for hiding this comment

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

default:
t.logger.Warn(t.ctx, "unhandled manager request", slog.F("request", msg))
return resp
}
if err := req.sendReply(resp); err != nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

The original code also sent resp := &TunnelMessage{} as a reply for the default: branch, so I assume it's still fine.

Copy link
Contributor

@spikecurtis spikecurtis left a comment

Choose a reason for hiding this comment

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

LGTM

@ethanndickson ethanndickson force-pushed the ethan/vpn-agents-netstatus branch from e3f8508 to 561f65f Compare December 5, 2024 01:56
@ethanndickson ethanndickson force-pushed the ethan/vpn-agents-netstatus branch from 561f65f to 6cd9c76 Compare December 5, 2024 02:15
@ethanndickson ethanndickson changed the base branch from ethan/vpn-client to graphite-base/15659 December 5, 2024 02:30
@ethanndickson ethanndickson force-pushed the ethan/vpn-agents-netstatus branch from 6cd9c76 to b2fd151 Compare December 5, 2024 02:30
@ethanndickson ethanndickson changed the base branch from graphite-base/15659 to main December 5, 2024 02:31
@ethanndickson ethanndickson force-pushed the ethan/vpn-agents-netstatus branch from b2fd151 to acdd09d Compare December 5, 2024 02:31
@ethanndickson ethanndickson merged commit a0a5683 into main Dec 5, 2024
31 checks passed
@ethanndickson ethanndickson deleted the ethan/vpn-agents-netstatus branch December 5, 2024 03:22
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.

Build a CoderVPN dynamic library and include it in the full coder binary
4 participants