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 ¶
FileSize calculates the file size and generate user-friendly string. (sources from gogs project)
func TimeSinceHuman ¶
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.
Click to show internal directories.
Click to hide internal directories.