dg

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DeviceAuth_LoginAuth_FullMethodName      = "/dg.DeviceAuth/loginAuth"
	DeviceAuth_AccessAuth_FullMethodName     = "/dg.DeviceAuth/accessAuth"
	DeviceAuth_DeviceRegister_FullMethodName = "/dg.DeviceAuth/deviceRegister"
)

Variables

View Source
var DeviceAuth_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "dg.DeviceAuth",
	HandlerType: (*DeviceAuthServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "loginAuth",
			Handler:    _DeviceAuth_LoginAuth_Handler,
		},
		{
			MethodName: "accessAuth",
			Handler:    _DeviceAuth_AccessAuth_Handler,
		},
		{
			MethodName: "deviceRegister",
			Handler:    _DeviceAuth_DeviceRegister_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "proto/dg.proto",
}

DeviceAuth_ServiceDesc is the grpc.ServiceDesc for DeviceAuth service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_proto_dg_proto protoreflect.FileDescriptor

Functions

func RegisterDeviceAuthServer

func RegisterDeviceAuthServer(s grpc.ServiceRegistrar, srv DeviceAuthServer)

Types

type AccessAuthReq

type AccessAuthReq struct {
	ProtocolType string `protobuf:"bytes,1,opt,name=protocolType,proto3" json:"protocolType,omitempty"` // 协议类型: iThings,iThings-thingsboard
	Username     string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`         //用户名
	Topic        string `protobuf:"bytes,3,opt,name=topic,proto3" json:"topic,omitempty"`               //主题
	ClientID     string `protobuf:"bytes,4,opt,name=clientID,proto3" json:"clientID,omitempty"`         //clientID
	Access       string `protobuf:"bytes,5,opt,name=access,proto3" json:"access,omitempty"`             //操作
	Ip           string `protobuf:"bytes,6,opt,name=ip,proto3" json:"ip,omitempty"`                     //访问的ip地址
	// contains filtered or unexported fields
}

func (*AccessAuthReq) Descriptor deprecated

func (*AccessAuthReq) Descriptor() ([]byte, []int)

Deprecated: Use AccessAuthReq.ProtoReflect.Descriptor instead.

func (*AccessAuthReq) GetAccess

func (x *AccessAuthReq) GetAccess() string

func (*AccessAuthReq) GetClientID

func (x *AccessAuthReq) GetClientID() string

func (*AccessAuthReq) GetIp

func (x *AccessAuthReq) GetIp() string

func (*AccessAuthReq) GetProtocolType

func (x *AccessAuthReq) GetProtocolType() string

func (*AccessAuthReq) GetTopic

func (x *AccessAuthReq) GetTopic() string

func (*AccessAuthReq) GetUsername

func (x *AccessAuthReq) GetUsername() string

func (*AccessAuthReq) ProtoMessage

func (*AccessAuthReq) ProtoMessage()

func (*AccessAuthReq) ProtoReflect

func (x *AccessAuthReq) ProtoReflect() protoreflect.Message

func (*AccessAuthReq) Reset

func (x *AccessAuthReq) Reset()

func (*AccessAuthReq) String

func (x *AccessAuthReq) String() string

type DeviceAuthClient

type DeviceAuthClient interface {
	// 设备登录认证
	LoginAuth(ctx context.Context, in *LoginAuthReq, opts ...grpc.CallOption) (*Response, error)
	// 设备操作认证
	AccessAuth(ctx context.Context, in *AccessAuthReq, opts ...grpc.CallOption) (*Response, error)
	// 设备动态注册
	DeviceRegister(ctx context.Context, in *DeviceRegisterReq, opts ...grpc.CallOption) (*DeviceRegisterResp, error)
}

DeviceAuthClient is the client API for DeviceAuth service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewDeviceAuthClient

func NewDeviceAuthClient(cc grpc.ClientConnInterface) DeviceAuthClient

type DeviceAuthServer

type DeviceAuthServer interface {
	// 设备登录认证
	LoginAuth(context.Context, *LoginAuthReq) (*Response, error)
	// 设备操作认证
	AccessAuth(context.Context, *AccessAuthReq) (*Response, error)
	// 设备动态注册
	DeviceRegister(context.Context, *DeviceRegisterReq) (*DeviceRegisterResp, error)
	// contains filtered or unexported methods
}

DeviceAuthServer is the server API for DeviceAuth service. All implementations must embed UnimplementedDeviceAuthServer for forward compatibility

type DeviceRegisterReq

type DeviceRegisterReq struct {
	ProductID  string `protobuf:"bytes,1,opt,name=productID,proto3" json:"productID,omitempty"`   //产品id
	DeviceName string `protobuf:"bytes,2,opt,name=deviceName,proto3" json:"deviceName,omitempty"` //设备名称
	Nonce      int64  `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"`          //随机数
	Timestamp  int64  `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`  //秒级时间戳
	Signature  string `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"`   //签名信息
	// contains filtered or unexported fields
}

func (*DeviceRegisterReq) Descriptor deprecated

func (*DeviceRegisterReq) Descriptor() ([]byte, []int)

Deprecated: Use DeviceRegisterReq.ProtoReflect.Descriptor instead.

func (*DeviceRegisterReq) GetDeviceName

func (x *DeviceRegisterReq) GetDeviceName() string

func (*DeviceRegisterReq) GetNonce

func (x *DeviceRegisterReq) GetNonce() int64

func (*DeviceRegisterReq) GetProductID

func (x *DeviceRegisterReq) GetProductID() string

func (*DeviceRegisterReq) GetSignature

func (x *DeviceRegisterReq) GetSignature() string

func (*DeviceRegisterReq) GetTimestamp

func (x *DeviceRegisterReq) GetTimestamp() int64

func (*DeviceRegisterReq) ProtoMessage

func (*DeviceRegisterReq) ProtoMessage()

func (*DeviceRegisterReq) ProtoReflect

func (x *DeviceRegisterReq) ProtoReflect() protoreflect.Message

func (*DeviceRegisterReq) Reset

func (x *DeviceRegisterReq) Reset()

func (*DeviceRegisterReq) String

func (x *DeviceRegisterReq) String() string

type DeviceRegisterResp

type DeviceRegisterResp struct {
	Len int64 `protobuf:"varint,1,opt,name=len,proto3" json:"len,omitempty"` //payload加密前信息的长度
	// 加密过程将原始 JSON 格式的 payload 转为字符串后进行 AES 加密,再进行 base64 加密。AES 加密算法为 CBC 模式,密钥长度128,取 productSecret 前16位,偏移量为长度16的字符“0”。
	// 原始 payload 内容说明:
	// key                value               描述
	// encryptionType     1              加密类型,1表示证书认证,2表示签名认证。
	// psk                1239           设备密钥,当产品认证类型为签名认证时有此参数
	// clientCert         -              设备证书文件字符串格式,当产品认证类型为证书认证时有此参数。
	// clientKey          -              设备私钥文件字符串格式,当产品认证类型为证书认证时有此参数。
	Payload string `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"`
	// contains filtered or unexported fields
}

func (*DeviceRegisterResp) Descriptor deprecated

func (*DeviceRegisterResp) Descriptor() ([]byte, []int)

Deprecated: Use DeviceRegisterResp.ProtoReflect.Descriptor instead.

func (*DeviceRegisterResp) GetLen

func (x *DeviceRegisterResp) GetLen() int64

func (*DeviceRegisterResp) GetPayload

func (x *DeviceRegisterResp) GetPayload() string

func (*DeviceRegisterResp) ProtoMessage

func (*DeviceRegisterResp) ProtoMessage()

func (*DeviceRegisterResp) ProtoReflect

func (x *DeviceRegisterResp) ProtoReflect() protoreflect.Message

func (*DeviceRegisterResp) Reset

func (x *DeviceRegisterResp) Reset()

func (*DeviceRegisterResp) String

func (x *DeviceRegisterResp) String() string

type LoginAuthReq

type LoginAuthReq struct {
	ProtocolType string `protobuf:"bytes,1,opt,name=protocolType,proto3" json:"protocolType,omitempty"` // 协议类型: iThings,iThings-thingsboard
	Username     string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`         //用户名
	Password     string `protobuf:"bytes,3,opt,name=password,proto3" json:"password,omitempty"`         //密码
	ClientID     string `protobuf:"bytes,4,opt,name=clientID,proto3" json:"clientID,omitempty"`         //clientID
	Ip           string `protobuf:"bytes,5,opt,name=ip,proto3" json:"ip,omitempty"`                     //访问的ip地址
	Certificate  []byte `protobuf:"bytes,6,opt,name=certificate,proto3" json:"certificate,omitempty"`   //客户端证书
	// contains filtered or unexported fields
}

func (*LoginAuthReq) Descriptor deprecated

func (*LoginAuthReq) Descriptor() ([]byte, []int)

Deprecated: Use LoginAuthReq.ProtoReflect.Descriptor instead.

func (*LoginAuthReq) GetCertificate

func (x *LoginAuthReq) GetCertificate() []byte

func (*LoginAuthReq) GetClientID

func (x *LoginAuthReq) GetClientID() string

func (*LoginAuthReq) GetIp

func (x *LoginAuthReq) GetIp() string

func (*LoginAuthReq) GetPassword

func (x *LoginAuthReq) GetPassword() string

func (*LoginAuthReq) GetProtocolType

func (x *LoginAuthReq) GetProtocolType() string

func (*LoginAuthReq) GetUsername

func (x *LoginAuthReq) GetUsername() string

func (*LoginAuthReq) ProtoMessage

func (*LoginAuthReq) ProtoMessage()

func (*LoginAuthReq) ProtoReflect

func (x *LoginAuthReq) ProtoReflect() protoreflect.Message

func (*LoginAuthReq) Reset

func (x *LoginAuthReq) Reset()

func (*LoginAuthReq) String

func (x *LoginAuthReq) String() string

type Request

type Request struct {
	Ping string `protobuf:"bytes,1,opt,name=ping,proto3" json:"ping,omitempty"`
	// contains filtered or unexported fields
}

func (*Request) Descriptor deprecated

func (*Request) Descriptor() ([]byte, []int)

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetPing

func (x *Request) GetPing() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

func (x *Request) ProtoReflect() protoreflect.Message

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Response

type Response struct {
	Pong string `protobuf:"bytes,1,opt,name=pong,proto3" json:"pong,omitempty"`
	// contains filtered or unexported fields
}

func (*Response) Descriptor deprecated

func (*Response) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetPong

func (x *Response) GetPong() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

func (x *Response) ProtoReflect() protoreflect.Message

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type UnimplementedDeviceAuthServer

type UnimplementedDeviceAuthServer struct {
}

UnimplementedDeviceAuthServer must be embedded to have forward compatible implementations.

func (UnimplementedDeviceAuthServer) AccessAuth

func (UnimplementedDeviceAuthServer) DeviceRegister

func (UnimplementedDeviceAuthServer) LoginAuth

type UnsafeDeviceAuthServer

type UnsafeDeviceAuthServer interface {
	// contains filtered or unexported methods
}

UnsafeDeviceAuthServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to DeviceAuthServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL