Skip to content

Return error in pickBest if no pingResult exists, fix #3

Pea Nut requested to merge fix-3 into main

This fixes #3.
Maybe we need to change the api/functionality of pickBest, so just a quick fix (add error handling)

Changes

  • return error if no ping results are there
  • use ping.New instead of ping.NewPinger (that already sends a ping)
  • improve logging a bit
  • fix bitmaskcfg cli tool

Thanks for steps to reproduce

pea@peabox:bitmaskcfg go run  ./main.go --verbose locations best --port 8443 --notls 
ERROR 2024/04/25 15:23:48 get config file: Config File ".bitmaskcfg" Not Found in "[/home/pea/tmp/go-build3763876636/b001/exe /home/pea/projects/leap/bitmask-core-fix-index/cmd/bitmaskcfg /home/pea]"
3:23PM INF Picking best location...
3:23PM INF Using host: localhost:8443 (ssl=false)
3:23PM DBG Disabling DNS over HTTP (not using SSL)
3:23PM WRN Could not ping host error="socket: permission denied" ip=198.252.153.109
3:23PM WRN Could not ping host error="socket: permission denied" ip=51.159.55.86
3:23PM WRN Could not ping host error="socket: permission denied" ip=51.158.144.32
3:23PM DBG results: 0
3:23PM DBG no-loss: 0
3:23PM FTL Could not pick best location error="Could not pick best result. Ping results are empty"
exit status 1

Merge request reports