mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 17:04:02 +03:00
Add load balancing network dialer
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package network
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultTimeout = 10 * time.Second
|
||||
DefaultDNSTimeout = time.Second
|
||||
DefaultHTTPTimeout = DefaultTimeout
|
||||
DefaultBufferSize = 4096
|
||||
)
|
||||
|
||||
var (
|
||||
ErrCircuitBreakerOpened = errors.New("circuit breaker is opened")
|
||||
ErrCannotDialWithAllProxies = errors.New("cannot dial with all proxies")
|
||||
)
|
||||
|
||||
type Dialer interface {
|
||||
Dial(network, address string) (net.Conn, error)
|
||||
DialContext(ctx context.Context, network, address string) (net.Conn, error)
|
||||
}
|
||||
Reference in New Issue
Block a user