36 lines
859 B
Go
36 lines
859 B
Go
package server
|
|
|
|
import (
|
|
crc "git.loafle.net/commons/rpc-go/codec"
|
|
crpj "git.loafle.net/commons/rpc-go/protocol/json"
|
|
cssw "git.loafle.net/commons/server-go/socket/web"
|
|
"git.loafle.net/overflow/probe_gateway_rpc/config"
|
|
"git.loafle.net/overflow/probe_gateway_rpc/servlet"
|
|
)
|
|
|
|
func New(_config *config.Config) *cssw.Server {
|
|
rpcServerCodec := crpj.NewCustomServerCodec(crc.NewCompressionCodecSelector(_config.ServerHandler.GetCompressionThreshold()))
|
|
|
|
as := &servlet.AuthServlets{}
|
|
as.RPCServerCodec = rpcServerCodec
|
|
as.UseSession = true
|
|
|
|
ps := &servlet.ProbeServlets{}
|
|
ps.RPCServerCodec = rpcServerCodec
|
|
ps.UseSession = true
|
|
|
|
sh := &ServerHandlers{
|
|
ServerHandlers: *_config.ServerHandler,
|
|
Config: _config,
|
|
}
|
|
|
|
sh.RegisterServlet("/auth", as)
|
|
sh.RegisterServlet("/probe", ps)
|
|
|
|
s := &cssw.Server{
|
|
ServerHandler: sh,
|
|
}
|
|
|
|
return s
|
|
}
|