Documentation ¶
Index ¶
- Constants
- Variables
- func AsyncNotify(ch chan struct{})
- func AsyncSendErr(ch chan error, err error)
- func ByteSize(bytes uint64) string
- func GenerateTLSConfig() *tls.Config
- func GetLocalIPSet() map[string]bool
- func GetLocalIPv4() []string
- func GetRequestURLString(req *http.Request) string
- func HTTPProxyConnect(proxyURL *url.URL, c net.Conn, addr string) error
- func IPv42Int(ip string) (int64, error)
- func IsPrivateIP(ip string) bool
- func IsTimeoutError(err error) bool
- func Long2IPv4(i uint64) string
- func PKCS7Pad(buf *bytes.Buffer, blen int)
- func PKCS7Unpad(in []byte) []byte
- func PeekTLSServerName(reader *bufio.Reader) (string, error)
- func PrepareRegexp(rule string) (*regexp.Regexp, error)
- func ProxyDial(proxyURL string, addr string, timeout time.Duration) (net.Conn, error)
- func RandAsciiString(n int) string
- func RandBetween(min, max int) int
- func ReadWithoutComment(file string, commentPrefix string) ([]byte, error)
- func Socks5ProxyConnect(proxyURL *url.URL, conn net.Conn, addr string) error
- func Socks5ProxyDial(proxyURL string, addr string, timeout time.Duration) (net.Conn, error)
- func ToBytes(s string) (uint64, error)
- func ToMegabytes(s string) (uint64, error)
- func WildcardMatch(text string, pattern string) bool
- type BufferChunkReader
- type DebugReader
- type TimeoutReadWriteCloser
Constants ¶
View Source
const ( BYTE = 1.0 KILOBYTE = 1024 * BYTE MEGABYTE = 1024 * KILOBYTE GIGABYTE = 1024 * MEGABYTE TERABYTE = 1024 * GIGABYTE )
copy from https://github.com/cloudfoundry/bytefmt/blob/master/bytes.go
Variables ¶
View Source
var ErrConnReset = errors.New("Conn reset")
View Source
var ErrNoSNI = errors.New("No SNI in protocol")
View Source
var ErrReadTimeout = errors.New("read timeout")
View Source
var ErrTLSClientHello = errors.New("Invalid tls client hello")
View Source
var ErrTLSIncomplete = errors.New("TLS header incomplete")
View Source
var ErrWriteTimeout = errors.New("write timeout")
Functions ¶
func AsyncNotify ¶ added in v0.27.0
func AsyncNotify(ch chan struct{})
asyncNotify is used to signal a waiting goroutine
func AsyncSendErr ¶ added in v0.27.0
func ByteSize ¶ added in v0.30.0
ByteSize returns a human-readable byte string of the form 10M, 12.5K, and so forth. The following units are available:
T: Terabyte G: Gigabyte M: Megabyte K: Kilobyte B: Byte
The unit that results in the smallest number greater than or equal to 1 is always chosen.
func GenerateTLSConfig ¶ added in v0.27.2
Setup a bare-bones TLS config for the server
func GetLocalIPSet ¶ added in v0.29.0
func GetLocalIPv4 ¶
func GetLocalIPv4() []string
func GetRequestURLString ¶
func HTTPProxyConnect ¶ added in v0.26.0
func IsPrivateIP ¶
func IsTimeoutError ¶ added in v0.26.0
func PKCS7Unpad ¶
Returns slice of the original data without padding.
func PeekTLSServerName ¶ added in v0.27.3
func RandAsciiString ¶
func RandBetween ¶
func ReadWithoutComment ¶
func Socks5ProxyConnect ¶ added in v0.26.0
func Socks5ProxyDial ¶ added in v0.26.0
func ToMegabytes ¶ added in v0.30.0
ToMegabytes parses a string formatted by ByteSize as megabytes.
func WildcardMatch ¶
Types ¶
type BufferChunkReader ¶
type DebugReader ¶ added in v0.26.3
type TimeoutReadWriteCloser ¶ added in v0.29.0
type TimeoutReadWriteCloser struct { io.ReadWriteCloser // contains filtered or unexported fields }
func (*TimeoutReadWriteCloser) Read ¶ added in v0.29.0
func (s *TimeoutReadWriteCloser) Read(p []byte) (n int, err error)
func (*TimeoutReadWriteCloser) SetReadDeadline ¶ added in v0.29.0
func (s *TimeoutReadWriteCloser) SetReadDeadline(t time.Time) error
func (*TimeoutReadWriteCloser) SetWriteDeadline ¶ added in v0.29.0
func (s *TimeoutReadWriteCloser) SetWriteDeadline(t time.Time) error
Click to show internal directories.
Click to hide internal directories.