Documentation ¶
Overview ¶
Package uds
Package uds ¶
Package uds ¶
Package uds ¶
Package uds ¶
Package uds ¶
Package uds ¶
Package uds ¶
Package uds
Index ¶
- Constants
- Variables
- func CreateSocket(s string) error
- func GetSocket(s string) string
- func ModuleName() string
- func RemoveSocket(s string) error
- func Response(c net.Conn, res Res) error
- func ResponseAny(c net.Conn, res interface{}) error
- func SetResponseBuilder(buildType int)
- type Func
- type FuncRaw
- type Funcs
- type Option
- type Req
- type Res
- type UDSContext
- type UDSServer
Constants ¶
View Source
const ( ErrUnsupportedOperation = "unsupported operation" ErrUnresolvedBody = "unresolved request body" ErrUdsListenerNil = "unix server listener is nil" ErrUdsAlreadyListen = "unix server already listened" )
Variables ¶
View Source
var AutoCheckOption = Option{ AutoCheck: true, AutoCheckDuration: 60, AutoRecover: false, ResponseFormat: Res{}, RequestFormat: Req{}, MaxSize: 1 << 10, LogTrace: true, }
Functions ¶
func CreateSocket ¶
CreateSocket 创建socket 默认监听时会创建遇到无权限时调用此方法创建 s app or app.socket
func ResponseAny ¶ added in v1.0.4
ResponseAny 响应任意数据
func SetResponseBuilder ¶ added in v1.1.12
func SetResponseBuilder(buildType int)
SetResponseBuilder 设置uds通信使用的流格式JSON YAML GOB FushinBuf
Types ¶
type Func ¶ added in v1.0.4
type Func func(c *UDSContext, req Req)
type UDSContext ¶ added in v1.0.4
type UDSContext struct {
// contains filtered or unexported fields
}
UDSContext UDS服务端的上下文
func (*UDSContext) Operation ¶ added in v1.0.4
func (uc *UDSContext) Operation() string
Operation 获取注册到此上下文的操作名称
func (*UDSContext) Response ¶ added in v1.0.4
func (uc *UDSContext) Response(res Res) error
Response 响应Res
func (*UDSContext) ResponseAny ¶ added in v1.0.4
func (uc *UDSContext) ResponseAny(res interface{}) error
ResponseAny 响应任意数据
type UDSServer ¶
type UDSServer struct { Name string // 注册服务的名称 Option Option // 默认使用fushin option Logger log.LoggerInterface // 默认使用fushin logger // contains filtered or unexported fields }
func NewWithOption ¶
func NewWithOption(name string, o Option, l log.LoggerInterface) *UDSServer
NewWithOption 返回自定义的unix server
func (*UDSServer) AddFunc ¶
func (u *UDSServer) AddFunc(operation string, f func(c *UDSContext, req Req))
AddFunc 增加uds响应的处理函数 响应会以注册的format格式化 针对不同的处理可以注册多个func处理请求 operation为请求中的操作关键字 用于匹配func
Click to show internal directories.
Click to hide internal directories.