Closed HidemaruOwO closed 2 years ago
コメントありがとうございます👀
現時点(v0.0.3
)でpinguは既にIPv6に対応はできているという認識でした。特にオプションを指定しなくてもIPv6のアドレスにpingできるはずです。
pinguが使用しているライブラリgo-ping/pingは既にIPv6をサポートしており、標準パッケージのnet.ResolveIPAddr()を使って自動でアドレスが解決されるはずです。
ping.go#L106:
New()
やNewPinger()
の初期化時に"ip"
という文字列を指定。これは自動でIPv4/IPv6が選択されるという意味っぽいです。 ping.go#L324:net.ResolveIPAddr()
でアドレスを解決。
具体的に、どのIPv6のアドレスを指定してエラーになってしまったか知りたいので、それを教えていただくか、もしくは適当なパブリックDNSサーバのIPv6アドレスを指定したときの結果を教えてほしいです。
Arch Linux x86 5.18.7-zen1-1-zen
$ pingu --version
pingu: v0.0.3-rev379c118
2001:4860:4860::8888
で試行した結果bin/pingu 2001:4860:4860::8888
PING 2001:4860:4860::8888 (2001:4860:4860::8888) type `Ctrl-C` to abort
... . ... .. .. ......... seq=0 32bytes from 2001:4860:4860::8888: ttl=112 time=20.821806ms
... .... .. .. ... ..... .. .. seq=1 32bytes from 2001:4860:4860::8888: ttl=112 time=16.942872ms
... ....... ... ... . ..... ####### seq=2 32bytes from 2001:4860:4860::8888: ttl=112 time=24.3364ms
..... ........ .###############..... ... ##########. . seq=3 32bytes from 2001:4860:4860::8888: ttl=112 time=15.070635ms
.... ........#####################. ... ########### seq=4 32bytes from 2001:4860:4860::8888: ttl=112 time=14.977373ms
....... ######################.... ############ seq=5 32bytes from 2001:4860:4860::8888: ttl=112 time=15.095098ms
. . .... ########################... ########### seq=6 32bytes from 2001:4860:4860::8888: ttl=112 time=15.500729ms
.. ....#########################.. .########### seq=7 32bytes from 2001:4860:4860::8888: ttl=112 time=14.796595ms
. #########################. .########## seq=8 32bytes from 2001:4860:4860::8888: ttl=112 time=17.134441ms
.... .########################. ######## seq=9 32bytes from 2001:4860:4860::8888: ttl=112 time=14.906298ms
..... . ####################. #######. seq=10 32bytes from 2001:4860:4860::8888: ttl=112 time=14.224035ms
...... .. . ################## . . .####### seq=11 32bytes from 2001:4860:4860::8888: ttl=112 time=15.218631ms
...... ##################### . .####### seq=12 32bytes from 2001:4860:4860::8888: ttl=112 time=15.401727ms
...... .########################### .. ####### seq=13 32bytes from 2001:4860:4860::8888: ttl=112 time=14.673982ms
... . ########################################. seq=14 32bytes from 2001:4860:4860::8888: ttl=112 time=22.14071ms
####################################### . seq=15 32bytes from 2001:4860:4860::8888: ttl=112 time=14.912607ms
################################## . seq=16 32bytes from 2001:4860:4860::8888: ttl=112 time=14.919792ms
################################### ........ seq=17 32bytes from 2001:4860:4860::8888: ttl=112 time=15.434441ms
.##################################### ......... seq=18 32bytes from 2001:4860:4860::8888: ttl=112 time=21.095229ms
.####################################### .... . . seq=19 32bytes from 2001:4860:4860::8888: ttl=112 time=14.630797ms
───────── 2001:4860:4860::8888 ping statistics ─────────
PACKET STATISTICS: 20 transmitted => 20 received (0% loss)
ROUND TRIP: min=14.224035ms avg=16.611713ms max=24.3364ms stddev=2.890968ms
pinger.SetNetwork() を指定することで、IPv4またはIPv6のどちらか片方の使用を強制することができるので、pinguのinitPinger()
関数の中身に以下を追記してビルド→実行するとIPv6のpingに成功するかもしれません。
func initPinger(host string, opts options) (*ping.Pinger, error) {
// 略...
pinger.SetNetwork("ip6")
// 略...
}
すみません。 pingu先のサーバーのファイアウォールがすべて拒否するようになってました.,,,,
概要
IPv6へのIPにpingする機会がありました。
pingu --help
でコマンドIPv6用のオプション等があるか確認したら存在しませんでした。再現手順
1, オプションなしの
pingu
コマンドでIPv6に対応してるかと思ったので、下のコマンドを実行しました。希望する動作
pinguコマンドに
-ipv6
オプションをつけて、引数にIPv6のアドレスを入力するとping結果が表示されるどうやらIPv6に対応してないようなので対応お願いします。
実行環境