From b26b0512f2fd3d2927ae27df5eb5bfcc0b90ac36 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Wed, 23 Oct 2024 12:40:30 +0300 Subject: [PATCH] Move all types in tcpclient to types.go --- tcpclient/client.go | 31 ------------------------------- tcpclient/types.go | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 tcpclient/types.go diff --git a/tcpclient/client.go b/tcpclient/client.go index 7c8972a..c44a85e 100644 --- a/tcpclient/client.go +++ b/tcpclient/client.go @@ -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() diff --git a/tcpclient/types.go b/tcpclient/types.go new file mode 100644 index 0000000..03b83c1 --- /dev/null +++ b/tcpclient/types.go @@ -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 +}