mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-26 02:14:44 +01:00
26 lines
475 B
Go
26 lines
475 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/zrepl/zrepl/config"
|
|
"net"
|
|
"time"
|
|
)
|
|
|
|
type TCPListenerFactory struct {
|
|
Address string
|
|
}
|
|
|
|
func parseTCPListenerFactory(c config.Global, in config.TCPServe) (*TCPListenerFactory, error) {
|
|
|
|
lf := &TCPListenerFactory{
|
|
Address: in.Listen,
|
|
}
|
|
return lf, nil
|
|
}
|
|
|
|
var TCPListenerHandshakeTimeout = 10 * time.Second // FIXME make configurable
|
|
|
|
func (f *TCPListenerFactory) Listen() (net.Listener, error) {
|
|
return net.Listen("tcp", f.Address)
|
|
}
|