You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
package request
import (
protocolpkg "github.com/noahlann/nnet/pkg/protocol"
)
// Request 请求接口
// 请求数据已经自动解析, Handler中可以直接使用
type Request interface {
// Raw 获取原始数据(未解码的字节,如果需要)
Raw ( ) [ ] byte
// Data 获取数据部分( 已自动解码为Go对象)
// 返回解析后的结构体,类型由路由配置指定
Data ( ) interface { }
// Bind 绑定到指定的结构体( 如果Data是map或其他类型, 可以绑定到struct)
// 主要用于动态类型绑定
Bind ( v interface { } ) error
// Header 获取协议帧头(已自动解析,如果有)
Header ( ) protocolpkg . FrameHeader
// DataBytes 获取数据部分的原始字节( 协议解码后但未进行codec解码)
// 主要用于需要手动解码的场景
DataBytes ( ) [ ] byte
// Protocol 获取协议信息
Protocol ( ) protocolpkg . Protocol
// ProtocolVersion 获取协议版本
ProtocolVersion ( ) string
}
// FrameHeader 协议帧头接口( 类型别名, 统一使用protocol.FrameHeader)
type FrameHeader = protocolpkg . FrameHeader