gudcat

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2019 License: MIT Imports: 4 Imported by: 0

README

gudcat

GoDoc

gudcat lets you send data via UDP in a more or less controlled manner.

Synopsis

# on the server
gudcat server :3000 > target.file

# on the client
gudcat client -size 512 -delay 1ms < source.file

Installation

go get -u github.com/mhutter/gudcat/gudcat

(yep, thats gudcat twice)

Usage

Usage:
    gudcat client [options] address
    gudcat server address
Client
Usage:
    gudcat client [options] address

Read data from stdin and send it to <address> via UDP.

Usage of flags:
  -delay duration
      Delay between packages. Valid time units are 'ns', 'us' (or 'µs'),
      'ms', 's', 'm', 'h'.
  -size int
      package size in bytes (default 64000)

Examples:
    gudcat client -delay 10ms -size 510 localhost:3388 < input.file
    gudcat client '[fe80::1]:3388'
Server
Usage:
    gudcat server [options] address

Listen on <address> for data and print it to stdout

Options:
  -timeout duration
      Valid time units are 'ns', 'us' (or 'µs'), 'ms', 's', 'm', 'h'.

Timeout: The timeout will only start once the server has
received some data. New data will reset the timeout.

Examples:
    gudcat server -timeout 1s :3388
    gudcat server [::]:3388
    gudcat server 127.0.0.1:3388

Documentation

Overview

Package gudcat lets you send data via UDP in a more or less controlled manner

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Addr  *net.UDPAddr
	Size  int64
	Delay time.Duration
}

Client contains options for connecting to an address and sending data.

func NewClient

func NewClient(addr *net.UDPAddr, size int64, delay time.Duration) *Client

NewClient returns a Client which sends data to addr. Data is sent in Packages of `size` bytes, with a delay in between packages.

func (*Client) Run

func (client *Client) Run() error

Run starts sending data from stdin to Addr.

type Server

type Server struct {
	Addr    *net.UDPAddr
	Timeout time.Duration
	// contains filtered or unexported fields
}

Server contains options to listen UDP data and write it to stdout.

func NewServer

func NewServer(addr *net.UDPAddr, timeout time.Duration) *Server

NewServer returns a Server that listens on addr

func (*Server) Run

func (server *Server) Run() error

Run starts the server

Directories

Path Synopsis
Command gudcat either starts a server to listen for data (gudcat server), or starts sending data itself (gudcat client).
Command gudcat either starts a server to listen for data (gudcat server), or starts sending data itself (gudcat client).

Jump to

Keyboard shortcuts

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