26 lines
424 B
Go
26 lines
424 B
Go
package web
|
|
|
|
import "fmt"
|
|
|
|
//ListenAddr host port listen information
|
|
type ListenAddr interface {
|
|
String() string
|
|
}
|
|
|
|
type listenAddr struct {
|
|
Addr string
|
|
Port int
|
|
}
|
|
|
|
//NewListenAddr create new instance of ListenAddr
|
|
func NewListenAddr(addr string, port int) listenAddr {
|
|
return listenAddr{
|
|
Addr: addr,
|
|
Port: port,
|
|
}
|
|
}
|
|
|
|
func (l listenAddr) String() string {
|
|
return fmt.Sprintf("%s:%s", l.Addr, fmt.Sprint(l.Port))
|
|
}
|