tools

package
v0.0.0-...-b6ef80e Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2015 License: MIT Imports: 3 Imported by: 4

Documentation

Index

Constants

View Source
const ValidHostAddressRegex = `^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$`

ValidHostAddressRegex regex for validate HostAddress

View Source
const ValidIPAddressRegex = `(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])`

ValidIPAddressRegex regex for validate IP

Variables

This section is empty.

Functions

func FileSize

func FileSize(s int64) string

FileSize calculates the file size and generate user-friendly string. (sources from gogs project)

func TimeSinceHuman

func TimeSinceHuman(start time.Time) string

TimeSinceHuman return a more human readable time duration

Types

type BroadcastReceiver

type BroadcastReceiver struct {
	// private fields:
	C chan broadcast
}

BroadcastReceiver a element that receive broadcast

func (*BroadcastReceiver) Read

func (r *BroadcastReceiver) Read() interface{}

read a value that has been broadcast, waiting until one is available if necessary.

type Broadcaster

type Broadcaster struct {
	// private fields:
	Listenc chan chan (chan broadcast)
	Sendc   chan<- interface{}
}

Broadcaster a element that emit broadcast

func NewBroadcaster

func NewBroadcaster() Broadcaster

NewBroadcaster create a new broadcaster object.

func (Broadcaster) Listen

func (b Broadcaster) Listen() BroadcastReceiver

Listen start listening to the broadcasts.

func (Broadcaster) Write

func (b Broadcaster) Write(v interface{})

broadcast a value to all listeners.

Jump to

Keyboard shortcuts

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