// Code generated by protoc-gen-go.
|
|
// source: site.proto
|
|
// DO NOT EDIT!
|
|
|
|
/*
|
|
Package site is a generated protocol buffer package.
|
|
|
|
It is generated from these files:
|
|
site.proto
|
|
|
|
It has these top-level messages:
|
|
ConfigRequest
|
|
ConfigResponse
|
|
*/
|
|
package site
|
|
|
|
import proto "github.com/chai2010/protorpc/proto"
|
|
import math "math"
|
|
|
|
import "io"
|
|
import "log"
|
|
import "net"
|
|
import "net/rpc"
|
|
import "time"
|
|
import protorpc "github.com/chai2010/protorpc"
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = math.Inf
|
|
|
|
// 配置信息请求结构
|
|
type ConfigRequest struct {
|
|
Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
|
|
Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
|
|
Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
}
|
|
|
|
func (m *ConfigRequest) Reset() { *m = ConfigRequest{} }
|
|
func (m *ConfigRequest) String() string { return proto.CompactTextString(m) }
|
|
func (*ConfigRequest) ProtoMessage() {}
|
|
|
|
func (m *ConfigRequest) GetData() string {
|
|
if m != nil && m.Data != nil {
|
|
return *m.Data
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *ConfigRequest) GetTime() string {
|
|
if m != nil && m.Time != nil {
|
|
return *m.Time
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *ConfigRequest) GetSign() string {
|
|
if m != nil && m.Sign != nil {
|
|
return *m.Sign
|
|
}
|
|
return ""
|
|
}
|
|
|
|
// 配置信息响应结构
|
|
type ConfigResponse struct {
|
|
Data *string `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
|
|
Time *string `protobuf:"bytes,2,opt,name=time" json:"time,omitempty"`
|
|
Sign *string `protobuf:"bytes,3,opt,name=sign" json:"sign,omitempty"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
}
|
|
|
|
func (m *ConfigResponse) Reset() { *m = ConfigResponse{} }
|
|
func (m *ConfigResponse) String() string { return proto.CompactTextString(m) }
|
|
func (*ConfigResponse) ProtoMessage() {}
|
|
|
|
func (m *ConfigResponse) GetData() string {
|
|
if m != nil && m.Data != nil {
|
|
return *m.Data
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *ConfigResponse) GetTime() string {
|
|
if m != nil && m.Time != nil {
|
|
return *m.Time
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *ConfigResponse) GetSign() string {
|
|
if m != nil && m.Sign != nil {
|
|
return *m.Sign
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func init() {
|
|
}
|
|
|
|
type SiteService interface {
|
|
GetConfig(in *ConfigRequest, out *ConfigResponse) error
|
|
GetBalanceType(in *ConfigRequest, out *ConfigResponse) error
|
|
}
|
|
|
|
// AcceptSiteServiceClient accepts connections on the listener and serves requests
|
|
// for each incoming connection. Accept blocks; the caller typically
|
|
// invokes it in a go statement.
|
|
func AcceptSiteServiceClient(lis net.Listener, x SiteService) {
|
|
srv := rpc.NewServer()
|
|
if err := srv.RegisterName("SiteService", x); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
for {
|
|
conn, err := lis.Accept()
|
|
if err != nil {
|
|
log.Fatalf("lis.Accept(): %v\n", err)
|
|
}
|
|
go srv.ServeCodec(protorpc.NewServerCodec(conn))
|
|
}
|
|
}
|
|
|
|
// RegisterSiteService publish the given SiteService implementation on the server.
|
|
func RegisterSiteService(srv *rpc.Server, x SiteService) error {
|
|
if err := srv.RegisterName("SiteService", x); err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// NewSiteServiceServer returns a new SiteService Server.
|
|
func NewSiteServiceServer(x SiteService) *rpc.Server {
|
|
srv := rpc.NewServer()
|
|
if err := srv.RegisterName("SiteService", x); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
return srv
|
|
}
|
|
|
|
// ListenAndServeSiteService listen announces on the local network address laddr
|
|
// and serves the given SiteService implementation.
|
|
func ListenAndServeSiteService(network, addr string, x SiteService) error {
|
|
lis, err := net.Listen(network, addr)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer lis.Close()
|
|
|
|
srv := rpc.NewServer()
|
|
if err := srv.RegisterName("SiteService", x); err != nil {
|
|
return err
|
|
}
|
|
|
|
for {
|
|
conn, err := lis.Accept()
|
|
if err != nil {
|
|
log.Fatalf("lis.Accept(): %v\n", err)
|
|
}
|
|
go srv.ServeCodec(protorpc.NewServerCodec(conn))
|
|
}
|
|
}
|
|
|
|
type SiteServiceClient struct {
|
|
*rpc.Client
|
|
}
|
|
|
|
// NewSiteServiceClient returns a SiteService rpc.Client and stub to handle
|
|
// requests to the set of SiteService at the other end of the connection.
|
|
func NewSiteServiceClient(conn io.ReadWriteCloser) (*SiteServiceClient, *rpc.Client) {
|
|
c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn))
|
|
return &SiteServiceClient{c}, c
|
|
}
|
|
|
|
func (c *SiteServiceClient) GetConfig(in *ConfigRequest, out *ConfigResponse) error {
|
|
return c.Call("SiteService.GetConfig", in, out)
|
|
}
|
|
func (c *SiteServiceClient) GetBalanceType(in *ConfigRequest, out *ConfigResponse) error {
|
|
return c.Call("SiteService.GetBalanceType", in, out)
|
|
}
|
|
|
|
// DialSiteService connects to an SiteService at the specified network address.
|
|
func DialSiteService(network, addr string) (*SiteServiceClient, *rpc.Client, error) {
|
|
c, err := protorpc.Dial(network, addr)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
return &SiteServiceClient{c}, c, nil
|
|
}
|
|
|
|
// DialSiteServiceTimeout connects to an SiteService at the specified network address.
|
|
func DialSiteServiceTimeout(network, addr string,
|
|
timeout time.Duration) (*SiteServiceClient, *rpc.Client, error) {
|
|
c, err := protorpc.DialTimeout(network, addr, timeout)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
return &SiteServiceClient{c}, c, nil
|
|
}
|