zaprpc

package module
v0.0.0-...-587949d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2025 License: MIT Imports: 17 Imported by: 0

README

ZapRPC ⚡

A minimal and easy-to-use RPC framework over QUIC and HTTP/2 for Go Developers!

ZapRPC utilizes the Go language itself as an IDL, eliminating the need for protobuf compilation and providing a seamless experience for Go developers.

Setup ⚙️

NOTE: Do ensure you have the latest versions of Golang available locally.

git clone https://github.com/acmpesuecc/zaprpc.git
cd zaprpc
go mod download
go mod tidy # if adding new modules 

Usage 🚀

The example/ directory contains basic client and server implementations.

Running the client:

go run example/client/main.go

Running the server:

go run example/server/main.go

Install and use in your project ♻️

Add Dependency:

go get github.com/achyuthcodes30/zaprpc

Import:

import "github.com/achyuthcodes30/zaprpc"

Then setup client and server as shown in example/

Contributing ⭐

Want to get involved? Check out the CONTRIBUTING.md guide to learn how you can contribute code, suggest improvements, or report issues.

License 📜

This project is licensed under the MIT License — free for personal and commercial use with attribution.

See the LICENSE file for more details.

Acknowledgements 🤝

Maintainer(s)

Achyuth Yogesh Sosale - [email protected]

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConn

func NewConn(ctx context.Context, target string, cfg *ConnectionConfig) (*quic.Conn, error)

func NewTransport

func NewTransport(addr string, logger *zap.Logger) (*quic.Transport, error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg *ClientConfig) *Client

func (*Client) Codec

func (c *Client) Codec() string

func (*Client) WithCodec

func (c *Client) WithCodec(codec Codec) *Client

func (*Client) WithLogger

func (c *Client) WithLogger(logger *zap.Logger) *Client

func (*Client) Zap

func (c *Client) Zap(conn *quic.Conn, serviceMethod string, args ...any) (any, error)

type ClientConfig

type ClientConfig struct {
	Codec  Codec
	Logger *zap.Logger
}

type Codec

type Codec interface {
	Name() string
	Marshal(w io.Writer, v any) error
	Unmarshal(r io.Reader, v any) error
}

type ConnectionConfig

type ConnectionConfig struct {
	TLSConfig  *tls.Config
	QUICConfig *quic.Config
}

type GOBCodec

type GOBCodec struct{}

func (*GOBCodec) Marshal

func (g *GOBCodec) Marshal(w io.Writer, v any) error

func (*GOBCodec) Name

func (g *GOBCodec) Name() string

func (*GOBCodec) Unmarshal

func (g *GOBCodec) Unmarshal(r io.Reader, v any) error

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cfg *ServerConfig) *Server

func (*Server) Codec

func (s *Server) Codec() string

func (*Server) RegisterService

func (s *Server) RegisterService(name string, service any)

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

func (*Server) WithCodec

func (s *Server) WithCodec(codec Codec) *Server

func (*Server) WithLogger

func (s *Server) WithLogger(logger *zap.Logger) *Server

func (*Server) WithQUICConfig

func (s *Server) WithQUICConfig(quicConfig *quic.Config) *Server

func (*Server) WithTLSConfig

func (s *Server) WithTLSConfig(tlsConfig *tls.Config) *Server

func (*Server) WithTransport

func (s *Server) WithTransport(transport *quic.Transport) *Server

type ServerConfig

type ServerConfig struct {
	TLSConfig     *tls.Config
	QUICConfig    *quic.Config
	QUICTransport *quic.Transport
	Codec         Codec
	Logger        *zap.Logger
}

type ZapResponse

type ZapResponse struct {
	Value any
}

Directories

Path Synopsis
example
client command
server command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL