mirror of
https://github.com/zrepl/zrepl.git
synced 2025-02-21 12:51:00 +01:00
22 lines
395 B
Go
22 lines
395 B
Go
|
package serve
|
||
|
|
||
|
import (
|
||
|
"github.com/zrepl/zrepl/config"
|
||
|
"net"
|
||
|
)
|
||
|
|
||
|
type TCPListenerFactory struct {
|
||
|
Address string
|
||
|
}
|
||
|
|
||
|
func TCPListenerFactoryFromConfig(c config.Global, in *config.TCPServe) (*TCPListenerFactory, error) {
|
||
|
lf := &TCPListenerFactory{
|
||
|
Address: in.Listen,
|
||
|
}
|
||
|
return lf, nil
|
||
|
}
|
||
|
|
||
|
func (f *TCPListenerFactory) Listen() (net.Listener, error) {
|
||
|
return net.Listen("tcp", f.Address)
|
||
|
}
|