weather/internal/net.go
2021-02-24 08:27:52 +01:00

26 lines
429 B
Go

package internal
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))
}