mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 16:01:55 +03:00
Refactor network to a top-level module
This commit is contained in:
+28
-1
@@ -1,5 +1,32 @@
|
||||
package mtglib
|
||||
|
||||
import "errors"
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
var ErrSecretEmpty = errors.New("secret is empty")
|
||||
|
||||
type Network interface {
|
||||
Dial(network, address string) (net.Conn, error)
|
||||
DialContext(ctx context.Context, network, address string) (net.Conn, error)
|
||||
MakeHTTPClient(func(ctx context.Context, network, address string) (net.Conn, error)) *http.Client
|
||||
IdleTimeout() time.Duration
|
||||
}
|
||||
|
||||
type Logger interface {
|
||||
Named(name string) Logger
|
||||
|
||||
BindInt(name string, value int) Logger
|
||||
BindStr(name, value string) Logger
|
||||
|
||||
Info(msg string)
|
||||
InfoError(msg string, err error)
|
||||
Warning(msg string)
|
||||
WarningError(msg string, err error)
|
||||
Debug(msg string)
|
||||
DebugError(msg string, err error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user