2017-12-05 05:20:42 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
|
|
|
|
"gopkg.in/natefinch/npipe.v2"
|
|
|
|
)
|
|
|
|
|
2017-12-05 07:29:42 +00:00
|
|
|
func newSocketBuilder(address string) *SocketBuilders {
|
2017-12-05 05:20:42 +00:00
|
|
|
sb := &SocketBuilders{}
|
|
|
|
sb.Network = "pipe"
|
|
|
|
sb.Address = address
|
|
|
|
|
|
|
|
return sb
|
|
|
|
}
|
|
|
|
|
|
|
|
func (sb *SocketBuilders) Dial(network, address string) (net.Conn, error) {
|
|
|
|
if 0 == sb.HandshakeTimeout {
|
|
|
|
return npipe.Dial(`\\.\pipe\` + address)
|
|
|
|
}
|
|
|
|
return npipe.DialTimeout(`\\.\pipe\`+address, sb.HandshakeTimeout)
|
|
|
|
}
|