package coap

import "codeberg.org/eris/eris-go/coap"

Index

Functions

func HandleGet

func HandleGet(store eris.Store, w mux.ResponseWriter, r *mux.Message)

func HandlePut

func HandlePut(store eris.Store, w mux.ResponseWriter, r *mux.Message)

Types

type Endpoint

type Endpoint struct {
	// contains filtered or unexported fields
}

func NewEndpoint

func NewEndpoint(store eris.Store) (ep *Endpoint)

Create a new CoAP endpoint that serves ERIS blocks from the given store.

func NewMulticastClient

func NewMulticastClient(ctx context.Context, store eris.Store) (ep *Endpoint, err error)

Create a new CoAP client that attemps multicast peers discovery on all interfaces. The passed store is used to respond to peer requests and may be nil.

func (*Endpoint) AddPeer

func (ep *Endpoint) AddPeer(host, port string, allow eris.AllowOps) (err error)

func (*Endpoint) Allowed

func (store *Endpoint) Allowed() eris.AllowOps

func (*Endpoint) Close

func (ep *Endpoint) Close() (err error)

Close the CoAP endpoint. The internal store is not closed.

func (*Endpoint) Drop

func (ep *Endpoint) Drop(ref eris.Ref) error

func (*Endpoint) Get

func (ep *Endpoint) Get(ctx context.Context, chunk []byte, ref eris.Ref) (err error)

func (*Endpoint) Has

func (ep *Endpoint) Has(ctx context.Context, ref eris.Ref, chunkSize int) bool

Check if the CoAP endpoint internal store has a chunk.

func (*Endpoint) Put

func (ep *Endpoint) Put(ctx context.Context, chunk []byte, ref eris.Ref) (err error)

Put a block to

func (ep *Endpoint) ServeMulticastLink(face string, allow eris.AllowOps) error

func (*Endpoint) ServeMulticastSite

func (ep *Endpoint) ServeMulticastSite(face string, allow eris.AllowOps) error

func (*Endpoint) ServeUnicast

func (ep *Endpoint) ServeUnicast(host, port string, allow eris.AllowOps) (err error)

Source Files

endpoint.go

Version
v0.0.0-20250117134628-64f8be33f6fe (latest)
Published
Jan 17, 2025
Platform
linux/amd64
Imports
25 packages
Last checked
1 day ago

Tools for package owners.