From f5c63cde56eb35c0125a0545f084441cdd4340ab Mon Sep 17 00:00:00 2001 From: Keuin Date: Tue, 11 Jul 2023 22:56:07 +0800 Subject: Refactor: move data structures to a separate package to avoid circular dependency. --- bilibili/client.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bilibili/client.go') diff --git a/bilibili/client.go b/bilibili/client.go index 65d858f..35d06e4 100644 --- a/bilibili/client.go +++ b/bilibili/client.go @@ -7,6 +7,7 @@ package bilibili import ( "context" "github.com/keuin/slbr/logging" + "github.com/keuin/slbr/types" "net" "net/http" ) @@ -21,15 +22,15 @@ type Bilibili struct { userAgent string http *http.Client ctx context.Context - netTypes []IpNetType + netTypes []types.IpNetType logger logging.Logger } -func NewBilibiliWithContext(ctx context.Context, netTypes []IpNetType, logger logging.Logger) Bilibili { - var nets []IpNetType +func NewBilibiliWithContext(ctx context.Context, netTypes []types.IpNetType, logger logging.Logger) Bilibili { + var nets []types.IpNetType nets = append(nets, netTypes...) if len(nets) == 0 { - nets = append(nets, IP64) + nets = append(nets, types.IP64) } var dialer net.Dialer @@ -47,7 +48,7 @@ func NewBilibiliWithContext(ctx context.Context, netTypes []IpNetType, logger lo } } -func NewBilibiliWithNetType(netTypes []IpNetType, logger logging.Logger) Bilibili { +func NewBilibiliWithNetType(netTypes []types.IpNetType, logger logging.Logger) Bilibili { ctx := context.Background() return NewBilibiliWithContext(ctx, netTypes, logger) } -- cgit v1.2.3