1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

coe - Go言語でCLIのTCPメッセージツール

Last updated at Posted at 2026-01-22
 ██████╗ ██████╗ ███████╗
██╔════╝██╔═══██╗██╔════╝
██║     ██║   ██║█████╗
██║     ██║   ██║██╔══╝
╚██████╗╚██████╔╝███████╗
 ╚═════╝ ╚═════╝ ╚══════╝

どんな人におすすめか

生のTCPメッセージを送受信する機会がある人、テストしたい人

※ "生のTCP" とは、HTTP などの上位プロトコルを用いないTCPソケット通信のことを言ってます

使用方法

  • -c でクライアントモードとして起動し、後続の引数で接続先(Host/Port)を指定したり、メッセージの終端文字(CR\LF)を指定します。
    • 以降は、Send>と表示されるので送信したいメッセージをタイプしてエンターで送信できます
  • -s でサーバモードとして起動し、ポート番号や終端文字を指定します
    • デフォルトで受信したメッセージをそのまま応答するエコーモードが有効で、--no-echo で無効化もできます
> coe -c localhost 8080 CR
Connection successful: localhost:8080
Terminator: CR (0x0D)
Buffer size: 1024 bytes
Chat started. Enter messages:
----------------------------------------
Send> Hi Bob
[Send] 2026-01-23 01:14:11.333 | Hi Bob (Bytes: 7, HEX: 486920426f620d)
[Recv] 2026-01-23 01:14:11.371 | Hi Alice (Bytes: 9, HEX: 486920416c6963650d)
Send>

色も付きます
image.png

インストール方法

  1. Goのインストール
    • Windowsの場合
      winget install GoLang.Go
      
    • macOSの場合
      brew install go
      
    • Ubuntu(apt)の場合
      apt install golang
      
  2. coe をインストール
go install github.com/yutat23/coe@latest

おわりに

似た用途のGUIデバッガをたまに仕事で使ってたんですが、GUIである必要ないよなと思いGoで作ってみた。

また似た用途で nc がありますが、仕事で使うことになった独自プロトコルは \r がコマンドの終端文字というプロトコルでした。
ncコマンドでは、対話モードで \r を送れないので そういうシーンで coe は需要あるかも。

Goを選んだ理由はGopherくんがかわいかったから。何も考えてなさそうなのがいい。
簡単に自己完結の単一exeで配布できるし、go installがマジで便利。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?