Documentation ¶
Index ¶
- Variables
- func CtxWithToken(ctx context.Context, token string) context.Context
- func GetAccept(opts message.Options) message.MediaType
- func GetDeviceIDFromIndetityCertificate(cert *x509.Certificate) (string, error)
- func NewVerifyPeerCertificate(rootCAs *x509.CertPool, ...) func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error
- func TokenFromCtx(ctx context.Context) (string, error)
- func VerifyIndetityCertificate(cert *x509.Certificate) error
- type Claims
- type ClaimsFunc
- type Client
- func (c *Client) Close() error
- func (c *Client) Context() context.Context
- func (c *Client) DeleteResource(ctx context.Context, href string, response interface{}, options ...OptionFunc) error
- func (c *Client) DeleteResourceWithCodec(ctx context.Context, href string, codec Codec, response interface{}, ...) error
- func (c *Client) GetResource(ctx context.Context, href string, response interface{}, options ...OptionFunc) error
- func (c *Client) GetResourceWithCodec(ctx context.Context, href string, codec Codec, response interface{}, ...) error
- func (c *Client) Observe(ctx context.Context, href string, codec Codec, handler ObservationHandler, ...) (Observation, error)
- func (c *Client) RemoteAddr() net.Addr
- func (c *Client) UpdateResource(ctx context.Context, href string, request interface{}, response interface{}, ...) error
- func (c *Client) UpdateResourceWithCodec(ctx context.Context, href string, codec Codec, request interface{}, ...) error
- type ClientCloseHandler
- func DialTCP(ctx context.Context, addr string, opts ...DialOptionFunc) (*ClientCloseHandler, error)
- func DialTCPSecure(ctx context.Context, addr string, tlsCfg *tls.Config, opts ...DialOptionFunc) (*ClientCloseHandler, error)
- func DialUDP(ctx context.Context, addr string, opts ...DialOptionFunc) (*ClientCloseHandler, error)
- func DialUDPSecure(ctx context.Context, addr string, dtlsCfg *piondtls.Config, ...) (*ClientCloseHandler, error)
- type ClientConn
- type CloseHandlerFunc
- type Codec
- type DecodeFunc
- type DialOptionFunc
- func WithDialDisablePeerTCPSignalMessageCSMs() DialOptionFunc
- func WithDialDisableTCPSignalMessageCSM() DialOptionFunc
- func WithDialer(dialer *net.Dialer) DialOptionFunc
- func WithErrors(errors func(err error)) DialOptionFunc
- func WithHeartBeat(heartBeat time.Duration) DialOptionFunc
- func WithKeepAlive(connectionTimeout time.Duration) DialOptionFunc
- func WithMaxMessageSize(maxMessageSize int) DialOptionFunc
- type EncodeFunc
- type Interceptor
- type Observation
- type ObservationHandler
- type OnCloseHandler
- type OptionFunc
- func WithAccept(contentFormat message.MediaType) OptionFunc
- func WithCredentialId(in int) OptionFunc
- func WithCredentialSubject(in string) OptionFunc
- func WithDeviceID(in string) OptionFunc
- func WithInstanceID(in int) OptionFunc
- func WithInterface(in string) OptionFunc
- func WithResourceType(in string) OptionFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ExtendedKeyUsage_IDENTITY_CERTIFICATE = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 44924, 1, 6}
Functions ¶
func GetDeviceIDFromIndetityCertificate ¶
func GetDeviceIDFromIndetityCertificate(cert *x509.Certificate) (string, error)
func NewVerifyPeerCertificate ¶
func NewVerifyPeerCertificate(rootCAs *x509.CertPool, verifyPeerCertificate func(verifyPeerCertificate *x509.Certificate) error) func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error
func VerifyIndetityCertificate ¶
func VerifyIndetityCertificate(cert *x509.Certificate) error
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(conn ClientConn) *Client
func (*Client) DeleteResource ¶
func (*Client) DeleteResourceWithCodec ¶
func (*Client) GetResource ¶
func (*Client) GetResourceWithCodec ¶
func (*Client) Observe ¶
func (c *Client) Observe( ctx context.Context, href string, codec Codec, handler ObservationHandler, options ...OptionFunc, ) (Observation, error)
Observe makes a CoAP observation request over a connection.
func (*Client) RemoteAddr ¶
func (*Client) UpdateResource ¶
func (*Client) UpdateResourceWithCodec ¶
type ClientCloseHandler ¶
type ClientCloseHandler struct { *Client // contains filtered or unexported fields }
func DialTCP ¶
func DialTCP(ctx context.Context, addr string, opts ...DialOptionFunc) (*ClientCloseHandler, error)
func DialTCPSecure ¶
func DialTCPSecure(ctx context.Context, addr string, tlsCfg *tls.Config, opts ...DialOptionFunc) (*ClientCloseHandler, error)
func DialUDP ¶
func DialUDP(ctx context.Context, addr string, opts ...DialOptionFunc) (*ClientCloseHandler, error)
func DialUDPSecure ¶
func DialUDPSecure(ctx context.Context, addr string, dtlsCfg *piondtls.Config, opts ...DialOptionFunc) (*ClientCloseHandler, error)
func (*ClientCloseHandler) RegisterCloseHandler ¶
func (c *ClientCloseHandler) RegisterCloseHandler(f CloseHandlerFunc) (closeHandlerID int)
func (*ClientCloseHandler) UnregisterCloseHandler ¶
func (c *ClientCloseHandler) UnregisterCloseHandler(closeHandlerID int)
type ClientConn ¶
type ClientConn = interface { Post(ctx context.Context, path string, contentFormat message.MediaType, payload io.ReadSeeker, opts ...message.Option) (*message.Message, error) Get(ctx context.Context, path string, opts ...message.Option) (*message.Message, error) Delete(ctx context.Context, path string, opts ...message.Option) (*message.Message, error) Observe(ctx context.Context, path string, observeFunc func(notification *message.Message), opts ...message.Option) (Observation, error) RemoteAddr() net.Addr Close() error Context() context.Context }
type CloseHandlerFunc ¶
type CloseHandlerFunc = func(err error)
type Codec ¶
type Codec interface { ContentFormat() message.MediaType Encode(v interface{}) ([]byte, error) Decode(m *message.Message, v interface{}) error }
Codec encodes/decodes according to the CoAP content format/media type.
func GetRawCodec ¶
GetRawCodec returns raw codec depends on contentFormat.
type DecodeFunc ¶
type DecodeFunc func(interface{}) error
DecodeFunc can be used to pass in the data type that should be decoded.
type DialOptionFunc ¶
type DialOptionFunc func(dialOptions) dialOptions
func WithDialDisablePeerTCPSignalMessageCSMs ¶
func WithDialDisablePeerTCPSignalMessageCSMs() DialOptionFunc
func WithDialDisableTCPSignalMessageCSM ¶
func WithDialDisableTCPSignalMessageCSM() DialOptionFunc
func WithDialer ¶
func WithDialer(dialer *net.Dialer) DialOptionFunc
func WithErrors ¶
func WithErrors(errors func(err error)) DialOptionFunc
func WithHeartBeat ¶
func WithHeartBeat(heartBeat time.Duration) DialOptionFunc
func WithKeepAlive ¶
func WithKeepAlive(connectionTimeout time.Duration) DialOptionFunc
WithKeepAlive sets a policy that detects dropped connections within the connTimeout limit while attempting to make 3 pings during that period.
func WithMaxMessageSize ¶
func WithMaxMessageSize(maxMessageSize int) DialOptionFunc
type EncodeFunc ¶
func GetEncoder ¶
func GetEncoder(accept message.MediaType) (EncodeFunc, error)
GetEncoder returns encoder by accept
type Interceptor ¶
func ValidateJWT ¶
func ValidateJWT(jwksURL string, tls *tls.Config, claims ClaimsFunc) Interceptor
type Observation ¶
type ObservationHandler ¶
type ObservationHandler interface { Handle(client *Client, body DecodeFunc) Error(err error) }
ObservationHandler receives notifications from the observation request.
type OnCloseHandler ¶
type OnCloseHandler struct {
// contains filtered or unexported fields
}
func NewOnCloseHandler ¶
func NewOnCloseHandler() *OnCloseHandler
func (*OnCloseHandler) Add ¶
func (h *OnCloseHandler) Add(onClose func(err error)) int
func (*OnCloseHandler) OnClose ¶
func (h *OnCloseHandler) OnClose(err error)
func (*OnCloseHandler) Remove ¶
func (h *OnCloseHandler) Remove(onCloseID int)
type OptionFunc ¶
func WithAccept ¶
func WithAccept(contentFormat message.MediaType) OptionFunc
func WithCredentialId ¶
func WithCredentialId(in int) OptionFunc
func WithCredentialSubject ¶
func WithCredentialSubject(in string) OptionFunc
func WithDeviceID ¶
func WithDeviceID(in string) OptionFunc
func WithInstanceID ¶
func WithInstanceID(in int) OptionFunc
func WithInterface ¶
func WithInterface(in string) OptionFunc
func WithResourceType ¶
func WithResourceType(in string) OptionFunc
Click to show internal directories.
Click to hide internal directories.