ZMQ

さて、前書いた通り、LNDはbitcoindとのinterfaceにはzeroMQっていうのを使う。
これが何かを調べる。Neutrinoを使うからそれほどクリティカルでは無いのだが。

 Ø  Connect your code in any language, on any platform.
 Ø  Carries messages across inproc, IPC, TCP, TIPC, multicast.
 Ø  Smart patterns like pub-sub, push-pull, and router-dealer.
 Ø  High-speed asynchronous I/O engines, in a tiny library.
 Ø  Backed by a large and active open source community.
 Ø  Supports every modern language and platform.
 Ø  Build any architecture: centralized, distributed, small, or large.
 Ø  Free software with full commercial support.

日本語だと

Øあらゆるプラットフォーム、あらゆる言語のコードを接続可能。
Øインプロセス、IPC、TCP、TIPC、マルチキャスト。
Øパブサブ、プッシュプル、ルーターディーラーのようなスマートなパターンに対応。
Ø小型のライブラリに収められた、高速非同期I/Oエンジン。
Ø大規模で活発なオープンソースコミュニティによる支援。
Øあらゆる言語とプラットフォームをサポート。
Ø集中型、分散型、小規模、大規模など、あらゆるアーキテクチャを構築。
Ø完全な商業サポートを備えたフリーソフトウェア。

と、いうことで、よくわからない。 まあ、socket IOみたいな感じかな?どうも、車の自動運転とかいろいろに使われるみたい。

goczmq

golangでは上記のパッケージがインターフェースになっている。下記のソースコードのノリを見ると、まあわかりそうだ。

    // Create a dealer socket and connect it to the router.
    dealer, err := goczmq.NewDealer("tcp://127.0.0.1:5555")
    if err != nil {
        log.Fatal(err)
    }
    defer dealer.Destroy()

    log.Println("dealer created and connected")

    // Send a 'Hello' message from the dealer to the router.
    // Here we send it as a frame ([]byte), with a FlagNone
    // flag to indicate there are no more frames following.
    err = dealer.SendFrame([]byte("Hello"), goczmq.FlagNone)
    if err != nil {
        log.Fatal(err)
    }

    log.Println("dealer sent 'Hello'")