Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
yamux
✓ github.com/libp2p/go-yamux/v3
Creates a yamux session over a TCP connection and exchanges a message.
package main
import (
"fmt"
"net"
"github.com/libp2p/go-yamux/v3"
)
func main() {
ln, _ := net.Listen("tcp", ":0")
go func() {
conn, _ := ln.Accept()
session, _ := yamux.Server(conn, nil)
stream, _ := session.Accept()
fmt.Fprintln(stream, "hello")
}()
conn, _ := net.Dial("tcp", ln.Addr().String())
session, _ := yamux.Client(conn, nil)
stream, _ := session.Open()
buf := make([]byte, 1024)
n, _ := stream.Read(buf)
fmt.Println(string(buf[:n]))
}
Debug
Known issues
No known issues recorded.
Upgrade
Version history
3.1.2latest on pkg.go.dev
Audit
Dependencies
No dependency data recorded yet.