|
@ -0,0 +1,198 @@ |
|
|
|
|
|
// Code generated by protoc-gen-go.
|
|
|
|
|
|
// source: sms.proto
|
|
|
|
|
|
// DO NOT EDIT!
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
Package smsrpc is a generated protocol buffer package. |
|
|
|
|
|
|
|
|
|
|
|
It is generated from these files: |
|
|
|
|
|
sms.proto |
|
|
|
|
|
|
|
|
|
|
|
It has these top-level messages: |
|
|
|
|
|
Request |
|
|
|
|
|
Response |
|
|
|
|
|
*/ |
|
|
|
|
|
package smsrpc |
|
|
|
|
|
|
|
|
|
|
|
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 Request 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 *Request) Reset() { *m = Request{} } |
|
|
|
|
|
func (m *Request) String() string { return proto.CompactTextString(m) } |
|
|
|
|
|
func (*Request) ProtoMessage() {} |
|
|
|
|
|
|
|
|
|
|
|
func (m *Request) GetData() string { |
|
|
|
|
|
if m != nil && m.Data != nil { |
|
|
|
|
|
return *m.Data |
|
|
|
|
|
} |
|
|
|
|
|
return "" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *Request) GetTime() string { |
|
|
|
|
|
if m != nil && m.Time != nil { |
|
|
|
|
|
return *m.Time |
|
|
|
|
|
} |
|
|
|
|
|
return "" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *Request) GetSign() string { |
|
|
|
|
|
if m != nil && m.Sign != nil { |
|
|
|
|
|
return *m.Sign |
|
|
|
|
|
} |
|
|
|
|
|
return "" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 信息响应结构
|
|
|
|
|
|
type Response 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 *Response) Reset() { *m = Response{} } |
|
|
|
|
|
func (m *Response) String() string { return proto.CompactTextString(m) } |
|
|
|
|
|
func (*Response) ProtoMessage() {} |
|
|
|
|
|
|
|
|
|
|
|
func (m *Response) GetData() string { |
|
|
|
|
|
if m != nil && m.Data != nil { |
|
|
|
|
|
return *m.Data |
|
|
|
|
|
} |
|
|
|
|
|
return "" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *Response) GetTime() string { |
|
|
|
|
|
if m != nil && m.Time != nil { |
|
|
|
|
|
return *m.Time |
|
|
|
|
|
} |
|
|
|
|
|
return "" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (m *Response) GetSign() string { |
|
|
|
|
|
if m != nil && m.Sign != nil { |
|
|
|
|
|
return *m.Sign |
|
|
|
|
|
} |
|
|
|
|
|
return "" |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func init() { |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
type SmsService interface { |
|
|
|
|
|
SendWoMsg(in *Request, out *Response) error |
|
|
|
|
|
SendTencentMsg(in *Request, out *Response) error |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// AcceptSmsServiceClient accepts connections on the listener and serves requests
|
|
|
|
|
|
// for each incoming connection. Accept blocks; the caller typically
|
|
|
|
|
|
// invokes it in a go statement.
|
|
|
|
|
|
func AcceptSmsServiceClient(lis net.Listener, x SmsService) { |
|
|
|
|
|
srv := rpc.NewServer() |
|
|
|
|
|
if err := srv.RegisterName("SmsService", 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)) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// RegisterSmsService publish the given SmsService implementation on the server.
|
|
|
|
|
|
func RegisterSmsService(srv *rpc.Server, x SmsService) error { |
|
|
|
|
|
if err := srv.RegisterName("SmsService", x); err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
return nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// NewSmsServiceServer returns a new SmsService Server.
|
|
|
|
|
|
func NewSmsServiceServer(x SmsService) *rpc.Server { |
|
|
|
|
|
srv := rpc.NewServer() |
|
|
|
|
|
if err := srv.RegisterName("SmsService", x); err != nil { |
|
|
|
|
|
log.Fatal(err) |
|
|
|
|
|
} |
|
|
|
|
|
return srv |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ListenAndServeSmsService listen announces on the local network address laddr
|
|
|
|
|
|
// and serves the given SmsService implementation.
|
|
|
|
|
|
func ListenAndServeSmsService(network, addr string, x SmsService) error { |
|
|
|
|
|
lis, err := net.Listen(network, addr) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
defer lis.Close() |
|
|
|
|
|
|
|
|
|
|
|
srv := rpc.NewServer() |
|
|
|
|
|
if err := srv.RegisterName("SmsService", 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 SmsServiceClient struct { |
|
|
|
|
|
*rpc.Client |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// NewSmsServiceClient returns a SmsService rpc.Client and stub to handle
|
|
|
|
|
|
// requests to the set of SmsService at the other end of the connection.
|
|
|
|
|
|
func NewSmsServiceClient(conn io.ReadWriteCloser) (*SmsServiceClient, *rpc.Client) { |
|
|
|
|
|
c := rpc.NewClientWithCodec(protorpc.NewClientCodec(conn)) |
|
|
|
|
|
return &SmsServiceClient{c}, c |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (c *SmsServiceClient) SendWoMsg(in *Request, out *Response) error { |
|
|
|
|
|
return c.Call("SmsService.SendWoMsg", in, out) |
|
|
|
|
|
} |
|
|
|
|
|
func (c *SmsServiceClient) SendTencentMsg(in *Request, out *Response) error { |
|
|
|
|
|
return c.Call("SmsService.SendTencentMsg", in, out) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// DialSmsService connects to an SmsService at the specified network address.
|
|
|
|
|
|
func DialSmsService(network, addr string) (*SmsServiceClient, *rpc.Client, error) { |
|
|
|
|
|
c, err := protorpc.Dial(network, addr) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return nil, nil, err |
|
|
|
|
|
} |
|
|
|
|
|
return &SmsServiceClient{c}, c, nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// DialSmsServiceTimeout connects to an SmsService at the specified network address.
|
|
|
|
|
|
func DialSmsServiceTimeout(network, addr string, |
|
|
|
|
|
timeout time.Duration) (*SmsServiceClient, *rpc.Client, error) { |
|
|
|
|
|
c, err := protorpc.DialTimeout(network, addr, timeout) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return nil, nil, err |
|
|
|
|
|
} |
|
|
|
|
|
return &SmsServiceClient{c}, c, nil |
|
|
|
|
|
} |