28 lines
558 B
Go
28 lines
558 B
Go
package grpc
|
|
|
|
import (
|
|
"context"
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
cgp "git.loafle.net/commons_go/grpc_pool"
|
|
oas "git.loafle.net/overflow/overflow_api_server/golang"
|
|
"git.loafle.net/overflow/overflow_gateway_probe/conf"
|
|
)
|
|
|
|
type poolHandlers struct {
|
|
cgp.PoolHandlers
|
|
ctx context.Context
|
|
}
|
|
|
|
func (h *poolHandlers) OnCreate() (*grpc.ClientConn, interface{}, error) {
|
|
var err error
|
|
conn, err := grpc.Dial(conf.Config.GRPC.Addr, grpc.WithInsecure())
|
|
if nil != err {
|
|
return nil, nil, err
|
|
}
|
|
c := oas.NewOverflowApiServerClient(conn)
|
|
return conn, c, nil
|
|
|
|
}
|