go-ping / ping

ICMP Ping library for Go
MIT License
1.31k stars 344 forks source link

Set outgouing interface #204

Closed TimofeyAf closed 2 years ago

TimofeyAf commented 2 years ago

Hello,

I tried to implement useful feature - send packets from specific network interface. This feature is platform specific (depend on syscall.BindToDevice). Hoping I did it correctly. Test successfully passed on Linux OS.

Thanks!

SuperQ commented 2 years ago

Hmm, seems like the test doesn't work in our CI pipeline.

TimofeyAf commented 2 years ago

Yes, I think problem in circleci environment because syscall return "socket: permission denied" (utils_linux.go:52). Maybe absent some Linux capabilities (example: CAP_NET_ADMIN).

SuperQ commented 2 years ago

It may be possible to run the tests if we change from running in a Go docker image to a machine build. But we would have to script setting up Go inside the machine.

The other option is to make this not included in short test.

TimofeyAf commented 2 years ago

I have added a "-short" flag in Makefile and made a few changes in my Test (skip). But circleci pipeline breakes in "goreleaser" stage (integrity check error).

CHTJonas commented 2 years ago

Unfortunately I agree with @mem here - I don't think that poking around in the internals of other packages is something we should be doing in go-ping. I appreciate that this is really useful, but I think it's better proposed as a change request upstream to the icmp.PacketConn package itself.