egor-tensin / setup-wireguard

GitHub action to set up WireGuard
MIT License
61 stars 21 forks source link

Connection status output #1

Closed tom-con closed 2 years ago

tom-con commented 2 years ago

Thanks so much for creating this! Quick question: Any way to retrieve a connection status as an output in a following step?

egor-tensin commented 2 years ago

@tom-con What do you mean a connection status? I believe that a WireGuard connection should be established unless this action's inputs were invalid (it will be established even if the other peer is offline, for example). If it doesn't, it's a bug in the action, and I'd be interested in fixing it.

When it comes to the actual packets coming through, it's another story. WireGuard tools themselves don't give any indication that packets do come through (except for the handshake timing, but this seems too hacky to parse from the output of wg). What I do in this action's workflow is just ping the host to check that packets come through successfully. I don't want to add this to the action, since it's just unnecessary overhead for most users, I believe. You can very much include a step like this in your workflow, it should reliably make sure that the connection was established successfully.

egor-tensin commented 2 years ago

Link to how I check the connection in this action's testing workflow: https://github.com/egor-tensin/setup-wireguard/blob/a92c6aebbcb4c6001c935911609fef8e325cda1c/.github/workflows/test.yml#L34.

tom-con commented 2 years ago

Link to how I check the connection in this action's testing workflow:

https://github.com/egor-tensin/setup-wireguard/blob/a92c6aebbcb4c6001c935911609fef8e325cda1c/.github/workflows/test.yml#L34

.

Thanks for the quick reply @egor-tensin, I will use your strategy with the ping to ensure an established connection! I'll let you know if I discover anything out of the ordinary, but gotta say I love the package, thanks for creating this.

tom-con commented 2 years ago

You can consider this resolved

egor-tensin commented 2 years ago

@tom-con Please do reach back if you see any problems.