Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

go-network

go.osspkg.com/network is a Go networking module with reusable clients and servers for TCP, UDP, and Unix domain sockets. It includes connection pooling, optional TLS, UDP message framing, and helpers for working with network addresses and file descriptors.

Requirements

  • Go 1.26 or later

Installation

go get go.osspkg.com/network/client

Import the packages you need, for example:

import (
	"go.osspkg.com/network/client"
	"go.osspkg.com/network/server"
)

Packages

Package Description
client Concurrent request handling over a bounded pool of reusable connections. Supports TCP, UDP, and Unix sockets.
server Handler-based TCP, UDP, and Unix servers with configurable connection limits and idle timeouts.
epoll Linux epoll-driven TCP server with ordered event callbacks and queued writes.
cert TLS configuration, certificate loading, and CA/server/client certificate generation.
listen TCP, UDP, and Unix listener creation, with optional TCP TLS wrapping.
proto/udpframe UDP message framing, fragmentation, parsing, and reassembly.
xnet Address normalization, IP helpers, and supported network constants.
fd File descriptor access for supported connections and os.File values.

Examples

Runnable examples are available in examples/client, examples/server, and examples/epoll-server. The regular server example implements a length-prefixed echo protocol over TCP, Unix sockets, or framed UDP. The epoll example is a Linux-only TCP byte-stream echo server.

For example, start a TCP echo server:

go run ./examples/server

Then run the client in another terminal:

go run ./examples/client -address 127.0.0.1:8080 -network tcp

On Linux, start the epoll example separately with go run ./examples/epoll-server -address 127.0.0.1:8082. It echoes raw TCP bytes and is not compatible with the length-prefixed client example.

See each example's -h output for available flags.

Development

Run package tests with:

go test ./...

The repository also provides make tests, make lint, make build, and make pre-commit targets.

License

This project is licensed under the BSD 3-Clause License. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages