Documentation ¶
Index ¶
- Constants
- func GRPCProxy(h interface{}) gin.HandlerFunc
- type Component
- func (c *Component) BuildWebsocket(opts ...WebSocketOption) *WebSocket
- func (c *Component) GracefulStop(ctx context.Context) error
- func (c *Component) Info() *server.ServiceInfo
- func (c *Component) Init() error
- func (c *Component) Name() string
- func (c *Component) PackageName() string
- func (c *Component) RegisterRouteComment(method, path, comment string)
- func (c *Component) Start() error
- func (c *Component) Stop() error
- func (c *Component) Upgrade(pattern string, ws *WebSocket, handler WebSocketFunc) gin.IRoutes
- type Config
- type Container
- type Option
- type WebSocket
- type WebSocketConn
- type WebSocketFunc
- type WebSocketOption
Constants ¶
View Source
const ( // HeaderAcceptEncoding ... HeaderAcceptEncoding = "Accept-Encoding" // HeaderContentType ... HeaderContentType = "Content-Type" // HeaderGRPCPROXYError ... HeaderGRPCPROXYError = "GRPC-Proxy-Error" // MIMEApplicationJSON ... MIMEApplicationJSON = "application/json" // MIMEApplicationJSONCharsetUTF8 ... MIMEApplicationJSONCharsetUTF8 = MIMEApplicationJSON + "; " + charsetUTF8 // MIMEApplicationProtobuf ... MIMEApplicationProtobuf = "application/protobuf" )
View Source
const PackageName = "server.egin"
PackageName 包名
Variables ¶
This section is empty.
Functions ¶
func GRPCProxy ¶ added in v0.5.5
func GRPCProxy(h interface{}) gin.HandlerFunc
GRPCProxy experimental
Types ¶
type Component ¶
Component ...
func (*Component) BuildWebsocket ¶ added in v0.5.5
func (c *Component) BuildWebsocket(opts ...WebSocketOption) *WebSocket
BuildWebsocket ..
func (*Component) GracefulStop ¶
GracefulStop implements server.Component interface it will stop gin server gracefully
func (*Component) Info ¶
func (c *Component) Info() *server.ServiceInfo
Info returns server info, used by governor and consumer balancer
func (*Component) RegisterRouteComment ¶
RegisterRouteComment 注册路由注释
type Config ¶
type Config struct { Host string // IP地址,默认0.0.0.0 Port int // PORT端口,默认9001 Mode string // gin的模式,默认是release模式 EnableMetricInterceptor bool // 是否开启监控,默认开启 EnableTraceInterceptor bool // 是否开启链路追踪,默认开启 EnableLocalMainIP bool // 自动获取ip地址 SlowLogThreshold time.Duration // 服务慢日志,默认500ms EnableAccessInterceptorReq bool // 是否开启记录请求参数,默认不开启 EnableAccessInterceptorRes bool // 是否开启记录响应参数,默认不开启 EnableTrustedCustomHeader bool // 是否开启自定义header头,记录数据往链路后传递,默认不开启 WebsocketHandshakeTimeout time.Duration // 握手时间 WebsocketReadBufferSize int WebsocketWriteBufferSize int EnableWebsocketCompression bool // 是否开通压缩 EnableWebsocketCheckOrigin bool // 是否支持跨域 }
Config HTTP config
type WebSocket ¶
WebSocket ..
func (*WebSocket) Upgrade ¶
func (ws *WebSocket) Upgrade(w http.ResponseWriter, r *http.Request, c *gin.Context, handler WebSocketFunc)
Upgrade get upgrage request
type WebSocketConn ¶
WebSocketConn ...
Click to show internal directories.
Click to hide internal directories.