V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
cloverstd
V2EX  ›  分享创造

用 Golang 写了个 tcping

  •  
  •   cloverstd ·
    cloverstd · 2017-10-11 23:48:33 +08:00 · 5742 次点击
    这是一个创建于 2359 天前的主题,其中的信息可能已经有所发展或是发生改变。

    来由

    以前工作的时候,经常需要看某个端口是否是通的,其实 telnet 完全可以胜任,但是 telnet 后面的地址只能是 ip port 这种形式,一般情况,地址复制来都是 ip:port 这种形式的,所以每次 telnet 都要手动去掉冒号,然后分割,有时复制来的地址还带协议,比如 https://www.baidu.com,这个时候就蛋疼了。

    然后我发现了 tcping 这个软件,但是秉承着造轮子的思想,我就用 Golang 重新造了一个。

    使用

    HTTP ping

    tcping https://baidu.com
    tcping -H baidu.com
    tcping -H baidu.com 80
    

    TCP ping

    tcping baidu.com
    tcping baidu.com:80
    tcping baidu.com 80
    

    安装

    MacOS

    brew tap cloverstd/tap && brew install tcping-go
    

    Linux

    下载对应的文件即可,下载地址 https://github.com/cloverstd/tcping/releases

    5 条回复    2017-10-16 08:21:35 +08:00
    timothyye
        1
    timothyye  
       2017-10-12 00:00:34 +08:00
    已 star
    wwqgtxx
        2
    wwqgtxx  
       2017-10-12 01:01:54 +08:00 via iPhone
    不打算编译个 windows 版本么
    hjc4869
        3
    hjc4869  
       2017-10-12 01:09:59 +08:00 via Android
    @wwqgtxx Windows 直接上 psping,MS 官方出品
    vus520
        4
    vus520  
       2017-10-15 16:28:27 +08:00
    顺路求一个 ICMP 的 GO 实现
    afpro
        5
    afpro  
       2017-10-16 08:21:35 +08:00
    用 python 包一个 telnet 多好呐
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5436 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 08:32 · PVG 16:32 · LAX 01:32 · JFK 04:32
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.