ing
This commit is contained in:
parent
c55c459f39
commit
41382db599
|
@ -26,7 +26,7 @@ func NewSocket(sb SocketBuilder, parentContext cuc.Context) (Socket, error) {
|
|||
logging.Logger().Panic("Client Socket: SocketContext must be specified")
|
||||
}
|
||||
|
||||
sh := sb.SocketHandler()
|
||||
sh := sb.GetSocketHandler()
|
||||
if nil == sh {
|
||||
logging.Logger().Panic("Client Socket: SocketHandler must be specified")
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ import (
|
|||
|
||||
type SocketBuilder interface {
|
||||
SocketContext(parent cuc.Context) SocketContext
|
||||
SocketHandler() SocketHandler
|
||||
|
||||
Dial(network, address string) (net.Conn, error)
|
||||
|
||||
GetSocketHandler() SocketHandler
|
||||
GetNetwork() string
|
||||
GetAddress() string
|
||||
GetTLSConfig() *tls.Config
|
||||
|
|
|
@ -11,6 +11,7 @@ import (
|
|||
)
|
||||
|
||||
type SocketBuilders struct {
|
||||
SocketHandler SocketHandler
|
||||
Network string
|
||||
Address string
|
||||
TLSConfig *tls.Config
|
||||
|
@ -25,8 +26,8 @@ func (sb *SocketBuilders) SocketContext(parent cuc.Context) SocketContext {
|
|||
return newSocketContext(parent)
|
||||
}
|
||||
|
||||
func (sb *SocketBuilders) SocketHandler() SocketHandler {
|
||||
return NewSocketHandler()
|
||||
func (sb *SocketBuilders) GetSocketHandler() SocketHandler {
|
||||
return sb.SocketHandler
|
||||
}
|
||||
|
||||
func (sb *SocketBuilders) GetNetwork() string {
|
||||
|
@ -69,6 +70,10 @@ func (sb *SocketBuilders) GetLocalAddress() net.Addr {
|
|||
}
|
||||
|
||||
func (sb *SocketBuilders) Validate() {
|
||||
if nil == sb.SocketHandler {
|
||||
logging.Logger().Panic("Client Socket: SocketHandler must be specified")
|
||||
}
|
||||
|
||||
if "" == sb.Network {
|
||||
logging.Logger().Panic("Client Socket: Network must be specified")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user