Move all types in tcpclient to types.go

This commit is contained in:
qowevisa 2024-10-23 12:40:30 +03:00
parent ecb6e12425
commit b26b0512f2
2 changed files with 38 additions and 31 deletions

View File

@ -11,17 +11,6 @@ import (
"git.qowevisa.me/Qowevisa/tcpmachine/tcpcommand"
)
type ClientConfiguration struct {
MessageEndRune rune
MessageSplitRune rune
//
Status uint32
ErrorResolver func(chan error)
//
ServerHandlerFunc func(server net.Conn)
//
}
func GetDefaultConfig() *ClientConfiguration {
return &ClientConfiguration{
MessageEndRune: '\n',
@ -34,26 +23,6 @@ func GetDefaultConfig() *ClientConfiguration {
}
}
type ErrorResolverFunc func(errors chan error)
type Client struct {
MessageEndRune rune
MessageSplitRune rune
//
addr string
Status uint32
exit chan bool
Server net.Conn
IsConnected bool
//
ServerHandlerFunc func(server net.Conn)
//
ErrorsChannel chan error
ErrorResolver ErrorResolverFunc
//
Commands []tcpcommand.Command
}
func CreateClient(addr string, options ...ClientOption) *Client {
conf := GetDefaultConfig()

38
tcpclient/types.go Normal file
View File

@ -0,0 +1,38 @@
package tcpclient
import (
"net"
"git.qowevisa.me/Qowevisa/tcpmachine/tcpcommand"
)
type ClientConfiguration struct {
MessageEndRune rune
MessageSplitRune rune
//
Status uint32
ErrorResolver func(chan error)
//
ServerHandlerFunc func(server net.Conn)
//
}
type ErrorResolverFunc func(errors chan error)
type Client struct {
MessageEndRune rune
MessageSplitRune rune
//
addr string
Status uint32
exit chan bool
Server net.Conn
IsConnected bool
//
ServerHandlerFunc func(server net.Conn)
//
ErrorsChannel chan error
ErrorResolver ErrorResolverFunc
//
Commands []tcpcommand.Command
}