ing
This commit is contained in:
parent
2b011ea8c3
commit
d57710e28e
|
@ -5,7 +5,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewSocketBuilder(address string, socketHandler csc.SocketHandler) csc.SocketBuilder {
|
func NewSocketBuilder(address string, socketHandler csc.SocketHandler) csc.SocketBuilder {
|
||||||
sb := newSocketBuilder(address)
|
sb := &SocketBuilders{}
|
||||||
|
sb.Network = "tcp"
|
||||||
|
sb.Address = address
|
||||||
sb.SocketHandler = socketHandler
|
sb.SocketHandler = socketHandler
|
||||||
return sb
|
return sb
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
package client
|
|
||||||
|
|
||||||
func newSocketBuilder(address string) *SocketBuilders {
|
|
||||||
sb := &SocketBuilders{}
|
|
||||||
sb.Network = "unix"
|
|
||||||
sb.Address = address
|
|
||||||
|
|
||||||
return sb
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
package client
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net"
|
|
||||||
|
|
||||||
"gopkg.in/natefinch/npipe.v2"
|
|
||||||
)
|
|
||||||
|
|
||||||
func newSocketBuilder(address string) *SocketBuilders {
|
|
||||||
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)
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user