transport

package
v0.0.0-...-121767f Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package transport is the network client layer. It is only used for basic binary body network communication without any business logic. By default, there is only one pluggable ServerTransport.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Handle(ctx context.Context, req []byte) (rsp []byte, err error)
}

Handler is the process function when server client receive a package.

type Options

type Options struct {
	ServiceName string
	Protocol    string
	Address     string
	Network     string
	Handler     Handler
	Listener    net.Listener

	EventLoopNum    int           // epoll loop 大小,默认取 CPU 核数
	IdleTimeout     time.Duration // 连接最大空闲时间
	KeepAlivePeriod time.Duration
	EnableH2C       bool

	CACertFile  string // ca certification file
	TLSCertFile string // server certification file
	TLSKeyFile  string // server key file
}

Options is the server options on start.

type Transport

type Transport interface {
	Serve(ctx context.Context, opts *Options) error
}

Transport defines the server client layer interface.

Directories

Path Synopsis
web
Package web provides support for http protocol by default, provides rpc server with http protocol, and provides rpc database for calling http protocol.
Package web provides support for http protocol by default, provides rpc server with http protocol, and provides rpc database for calling http protocol.

Jump to

Keyboard shortcuts

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