Lobo Nokewe Ngewe
Lobo Nokewe Ngewe

Reputation: 183

golang.org/x/net/icmp: set Time To Live (TTL)

Go has built-in ICMP implementation that available on golang.org/x/net/icmp, is there any way to set TTL in this library ?, thankyou

Upvotes: 2

Views: 485

Answers (1)

Lobo Nokewe Ngewe
Lobo Nokewe Ngewe

Reputation: 183

I found the answer from mattn code :

c.IPv4PacketConn().SetTTL(64) // for ipv4
c.IPv6PacketConn().HopLimit(64) // for ipv6

https://gist.github.com/mattn/7ff153fe8491a2900e83#file-ping_test-go-L24-L28

Upvotes: 3

Related Questions