udp

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2021 License: MIT Imports: 7 Imported by: 0

README

UDP

Provides two sub-packages

  • udps (UDP Server)
  • udpc (UDP Client)

Example

TODO

Documentation

Overview

Package udp provides common functionality used in udpc and udps packages

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	ID() string
	String() string
	Close(code int, reason string)

	Send(msg *network.Message) (rmsg *network.Message, err error)
	OpenStream(data map[string]string) (stream *Stream, err error)
	CloseStream(id string)
}

Client Interface stipulates functions which should be present in a client

type Stream

type Stream struct {
	// Stream ID
	Id string

	// Stream Metadata
	Data map[string]string

	// Exit Channel
	Exit chan bool
	// Closed Status
	Closed bool
	// contains filtered or unexported fields
}

Stream

func HandleStream

func HandleStream(logger *logrus.Logger, stream quic.Stream, unmarshalers []network.ChannelUnmarshaler) (cstream *Stream, err error)

func NewStream

func NewStream(data map[string]string, channel *network.Channel) (s *Stream, err error)

func NewStreamFromData

func NewStreamFromData(data *model.StreamConnectionData, channel *network.Channel) *Stream

func (*Stream) Channel

func (s *Stream) Channel() *network.Channel

func (*Stream) Close

func (s *Stream) Close()

func (*Stream) Stream

func (s *Stream) Stream() quic.Stream

func (*Stream) String

func (s *Stream) String() string

type StreamHandler

type StreamHandler func(Client, *Stream)

On New Stream Handler

Directories

Path Synopsis
Package udpc provides functionality to create a UDP Client
Package udpc provides functionality to create a UDP Client
Package udps provides functionality to create a UDP Server
Package udps provides functionality to create a UDP Server

Jump to

Keyboard shortcuts

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