Erlgo
Go library for Erlang port protocol communication - handles length-prefixed binary messages between Go and Erlang/OTP ports
Install / Use
/learn @mochams/ErlgoREADME
erlgo 🚀
A lightweight Go library that implements the Erlang port protocol for communication between Go and Erlang/OTP applications.
Features
- Implements standard Erlang port protocol (4-byte length prefix)
- Clean, simple API for reading and writing messages
- Zero dependencies beyond Go standard library
- Designed for efficiency with buffered reading
Installation
go get github.com/mochams/erlgo@latest
Usage
package main
import (
"log"
"github.com/mochams/erlgo"
)
func main() {
// Read a message from Erlang
messageBytes, err := erlgo.Receive()
if err != nil {
log.Fatal(err)
}
// Process your message bytes here...
// Write a response back to Erlang
response := []byte("your response data")
if err := erlgo.Send(response); err != nil {
log.Fatal(err)
}
}
API
Receive
func Receive() ([]byte, error)
Reads a length-prefixed message from Erlang through stdin. Returns the message bytes and any error encountered.
Send
func Send(messageBytes []byte) error
Writes a length-prefixed message to Erlang through stdout. Takes the message bytes and returns any error encountered.
Erlang Port Protocol
The library implements the standard Erlang port protocol where each message is prefixed with a 4-byte length in big-endian order, followed by the actual message content.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Acknowledgments
Inspired by the needs of the Erlang/OTP community for reliable Go port communication.
Related Skills
node-connect
349.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
