Documentation ¶
Overview ¶
Udp socket builder
Example (Client1) ¶
c := udp.NewClient(rndzServer, "c1", netip.AddrPort{}) defer c.Close() l, _ := c.Listen(context.Background()) defer l.Close() buf := make([]byte, 5) for { l.ReadFrom(buf) // ... }
Output:
Example (Client2) ¶
c := udp.NewClient(rndzServer, "c2", netip.AddrPort{}) defer c.Close() conn, _ := c.Connect(context.Background(), "c1") conn.Write([]byte("hello")) defer conn.Close()
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Udp socket builder
func New ¶
set rendezvous server, peer identity, local bind address. if no local address set, choose according server address type(ipv4 or ipv6).
Click to show internal directories.
Click to hide internal directories.