mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 02:04:01 +03:00
FILE / ScuroNeko/mtg
network/init.go
Исходный файл и его история в репозитории.
32 lines
710 B
Go
32 lines
710 B
Go
package network
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"net"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
DefaultTimeout = 10 * time.Second
|
|
DefaultHTTPTimeout = 10 * time.Second
|
|
DefaultBufferSize = 16 * 1024 // 16 kib
|
|
|
|
ProxyDialerOpenThreshold = 5
|
|
ProxyDialerHalfOpenTimeout = time.Minute
|
|
ProxyDialerResetFailuresTimeout = 10 * time.Second
|
|
|
|
DefaultDOHHostname = "9.9.9.9"
|
|
DNSTimeout = 5 * time.Second
|
|
)
|
|
|
|
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)
|
|
}
|