zu1k / nali

An offline tool for querying IP geographic information and CDN provider. 一个查询IP地理信息和CDN服务提供商的离线终端工具.
https://github.com/zu1k/nali
MIT License
3.76k stars 340 forks source link

fix: a problem that cannot read mtr output from pipe #132

Closed mzz2017 closed 2 years ago

mzz2017 commented 2 years ago

bufio.ScanLines scans lines using \r?\n by default, which prevents us from reading the output of some programs from a pipe, such as mtr.

Because these programs use \r for newlines, we can use strace to know that.

This PR fixed it by using \r?\n|\r\n? to check the newline.

To reproduce it, try:

mtr 223.5.5.5 --curses | nali

Thanks co-debuggers @chinggg @cubercsl .

mzz2017 commented 2 years ago

I have read those issues and fixed the format problem.

zu1k commented 2 years ago

Thank you, I have test it, it works well with mtr.