listen

package
Version: v0.0.0-...-cbf0cb9 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package listen provides convenient ways to create and manage listeners.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func URI

func URI(address string) (net.Listener, error)

URI creates net.Listener from address in the URI format.

Examples:

URI("tcp:127.0.0.1:1337")
URI("tcp:[::1]:1337")
URI("unix:/tmp/netd.sock")

See net.Listen for more details about listening and address syntax.

Example
package main

import (
	"fmt"

	"github.com/Invizory/netd/listen"
)

func main() {
	listener, _ := listen.URI("tcp:[::1]:1337")
	defer listener.Close()
	fmt.Println(listener.Addr())
}
Output:

[::1]:1337
Example (Unix)
package main

import (
	"fmt"

	"github.com/Invizory/netd/listen"
)

func main() {
	listener, _ := listen.URI("unix:/tmp/netd.sock")
	defer listener.Close()
	fmt.Println(listener.Addr())
}
Output:

/tmp/netd.sock

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL