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

Replace shell-out + string parsing with gopacket/routing #317

Closed
mortenlj opened this issue Sep 26, 2023 · 1 comment
Closed

Replace shell-out + string parsing with gopacket/routing #317

mortenlj opened this issue Sep 26, 2023 · 1 comment

Comments

@mortenlj
Copy link
Contributor

We call ip route get 1.1.1.1 and then parse the returned output to extract interface name and IP1.
This has all sorts of funny edge cases and brittleness, so instead we should see if we can use a library2 for this.

Found a blogpost for this exact case:
https://engineering.qubecinema.com/2019/05/13/go-routing-package.html

Footnotes

  1. https://github.com/nais/device/blob/master/pkg/wireguard/iptables.go#L11

  2. https://pkg.go.dev/github.com/google/gopacket/routing?utm_source=godoc

@sechmann
Copy link
Contributor

sechmann commented Nov 3, 2023

done

@sechmann sechmann closed this as completed Nov 3, 2023
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

No branches or pull requests

2 participants