This commit is contained in:
crusader 2017-12-15 16:34:12 +09:00
parent 2b011ea8c3
commit d57710e28e
3 changed files with 3 additions and 32 deletions

View File

@ -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
} }

View File

@ -1,9 +0,0 @@
package client
func newSocketBuilder(address string) *SocketBuilders {
sb := &SocketBuilders{}
sb.Network = "unix"
sb.Address = address
return sb
}

View File

@ -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)
}