Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add Listen function

  • Loading branch information...
commit a50fdae10e39dfdca88fb31eeedb6f08abfbed6a 1 parent 99c8873
Brad Fitzpatrick authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 listen/listen.go
10 listen/listen.go
View
@@ -10,6 +10,7 @@ import (
"strings"
)
+// NewFlag returns a flag that implements the flag.Value interface.
func NewFlag(flagName, defaultValue string, serverType string) *Addr {
addr := &Addr{
s: defaultValue,
@@ -18,6 +19,15 @@ func NewFlag(flagName, defaultValue string, serverType string) *Addr {
return addr
}
+// Listen is a replacement for net.Listen that also respects runsit
+// listeners: port, :port, ip:port, FD:<fd_num>, ADDR:<name> or <name>
+// named ports.
+// Listeners are always TCP.
+func Listen(addr string) (net.Listener, error) {
+ a := &Addr{s: addr}
+ return a.Listen()
+}
+
// Usage returns a descriptive usage message for a flag given the name
// of thing being addressed.
func Usage(name string) string {
Please sign in to comment.
Something went wrong with that request. Please try again.