package httpu
Import Path
github.com/huin/goupnp/httpu (on go.dev)
Dependency Relation
imports 12 packages, and imported by 2 packages
Package-Level Type Names (total 8)
ClientInterface is the general interface provided to perform HTTP-over-UDP
requests.
Do performs a request. The timeout is how long to wait for before returning
the responses that were received. An error is only returned for failing to
send the request. Failures in receipt simply do not add to the resulting
responses.
*HTTPUClient
*MultiClient
github.com/huin/goupnp/ssdp.HTTPUClient (interface)
ClientInterface : github.com/huin/goupnp/ssdp.HTTPUClient
func NewMultiClient(delegates []ClientInterface) *MultiClient
ClientInterfaceCtx is the equivalent of ClientInterface, except with methods
taking a context.Context parameter.
DoWithContext performs a request. If the input request has a
deadline, then that value will be used as the timeout for how long
to wait before returning the responses that were received. If the
request's context is canceled, this method will return immediately.
If the request's context is never canceled, and does not have a
deadline, then this function WILL NEVER RETURN. You MUST set an
appropriate deadline on the context, or otherwise cancel it when you
want to finish an operation.
An error is only returned for failing to send the request. Failures
in receipt simply do not add to the resulting responses.
*HTTPUClient
*MultiClientCtx
github.com/huin/goupnp/ssdp.HTTPUClientCtx (interface)
ClientInterfaceCtx : github.com/huin/goupnp/ssdp.HTTPUClientCtx
func NewMultiClientCtx(delegates []ClientInterfaceCtx) *MultiClientCtx
Handler is the interface by which received HTTPU messages are passed to
handling code.
ServeMessage is called for each HTTPU message received. peerAddr contains
the address that the message was received from.
HandlerFunc
*github.com/huin/goupnp/ssdp.Registry
func Serve(l net.PacketConn, handler Handler) error
HandlerFunc is a function-to-Handler adapter.
( HandlerFunc) ServeMessage(r *http.Request)
HandlerFunc : Handler
HTTPUClient is a client for dealing with HTTPU (HTTP over UDP). Its typical
function is for HTTPMU, and particularly SSDP.
Close shuts down the client. The client will no longer be useful following
this.
Do implements ClientInterface.Do.
Note that at present only one concurrent connection will happen per
HTTPUClient.
DoWithContext implements ClientInterfaceCtx.DoWithContext.
Make sure to read the documentation on the ClientInterfaceCtx interface
regarding cancellation!
*HTTPUClient : ClientInterface
*HTTPUClient : ClientInterfaceCtx
*HTTPUClient : github.com/huin/goupnp/ssdp.HTTPUClient
*HTTPUClient : github.com/huin/goupnp/ssdp.HTTPUClientCtx
*HTTPUClient : github.com/prometheus/common/expfmt.Closer
*HTTPUClient : io.Closer
func NewHTTPUClient() (*HTTPUClient, error)
func NewHTTPUClientAddr(addr string) (*HTTPUClient, error)
MultiClient dispatches requests out to all the delegated clients.
Do implements ClientInterface.Do.
*MultiClient : ClientInterface
*MultiClient : github.com/huin/goupnp/ssdp.HTTPUClient
func NewMultiClient(delegates []ClientInterface) *MultiClient
MultiClientCtx dispatches requests out to all the delegated clients.
DoWithContext implements ClientInterfaceCtx.DoWithContext.
*MultiClientCtx : ClientInterfaceCtx
*MultiClientCtx : github.com/huin/goupnp/ssdp.HTTPUClientCtx
func NewMultiClientCtx(delegates []ClientInterfaceCtx) *MultiClientCtx
A Server defines parameters for running an HTTPU server.
// UDP address to listen on
// handler to invoke
// Network interface to listen on for multicast, nil for default multicast interface
// maximum number of bytes to read from a packet, DefaultMaxMessageBytes if 0
// Should listen for multicast?
ListenAndServe listens on the UDP network address srv.Addr. If srv.Multicast
is true, then a multicast UDP listener will be used on srv.Interface (or
default interface if nil).
Serve messages received on the given packet listener to the srv.Handler.
func github.com/huin/goupnp/ssdp.NewServerAndRegistry() (*Server, *ssdp.Registry)
Package-Level Functions (total 5)
NewHTTPUClient creates a new HTTPUClient, opening up a new UDP socket for the
purpose.
NewHTTPUClientAddr creates a new HTTPUClient which will broadcast packets
from the specified address, opening up a new UDP socket for the purpose
NewMultiClient creates a new MultiClient that delegates to all the given
clients.
NewMultiClient creates a new MultiClient that delegates to all the given
clients.
Serve messages received on the given packet listener to the given handler.
Package-Level Constants (total 2)
const DefaultMaxMessageBytes = 2048 const LocalAddressHeader = "goupnp-local-address"![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |