Documentation
¶
Index ¶
- Variables
- func AbnormalExit()
- func BackupFile(path string, bakPath string) error
- func CanDecodeContentEncoding(encoding string) bool
- func CheckNilField(object interface{}, allowNoPointerField bool) error
- func CheckStaticFile(filename string, sizeLimit int64) error
- func CipherSuiteTextForOpenSSL(suite uint16) string
- func ConfPathProc(confPath string, confRoot string) string
- func CopyFile(src, dst string) (int64, error)
- func CopyWithoutBuffer(wf bfe_http.WriteFlusher, src io.Reader) (written int64, err error)
- func DecodeContentEncoding(encoding string, data []byte) ([]byte, error)
- func DumpJson(jsonObject interface{}, filePath string, perm os.FileMode) error
- func FormatAsPrometheusLabelValue(originValue string) string
- func GetConnFile(conn net.Conn) (*os.File, error)
- func GetTCPConn(conn net.Conn) (*net.TCPConn, error)
- func GetVip(conn net.Conn) net.IP
- func GetVipPort(conn net.Conn) (net.IP, int, error)
- func GetsockoptMultiByte(fd, level, opt int) ([]byte, error)
- func IsBigEndian() bool
- func LoadJsonFile(path string, jsonObject interface{}) error
- func NativeUint16(data []byte) uint16
- func NewContentDecoder(encoding string, r io.Reader) (io.ReadCloser, error)
- func NormalExit()
- func ParseIpAndPort(addr string) (net.IP, int, error)
- func ParseTime(timeStr string) (time.Time, error)
- func ParseTimeOfDay(timeStr string) (time.Time, int, error)
- func SupportedContentEncodings() []string
- func VersionTextForOpenSSL(ver uint16) string
- type AddressFetcher
- type CloseWriter
- type ConnFetcher
- type FixedPool
- type MockConn
- type MockHandler
- type MockServer
Constants ¶
This section is empty.
Variables ¶
var ( // TimeZoneMap reference: https://en.wikipedia.org/wiki/List_of_military_time_zones TimeZoneMap = map[string]int{ "Y": -12 * 3600, "X": -11 * 3600, "W": -10 * 3600, "V": -9 * 3600, "U": -8 * 3600, "T": -7 * 3600, "S": -6 * 3600, "R": -5 * 3600, "Q": -4 * 3600, "P": -3 * 3600, "O": -2 * 3600, "N": -1 * 3600, "Z": 0, "A": 1 * 3600, "B": 2 * 3600, "C": 3 * 3600, "D": 4 * 3600, "E": 5 * 3600, "F": 6 * 3600, "G": 7 * 3600, "H": 8 * 3600, "I": 9 * 3600, "K": 10 * 3600, "L": 11 * 3600, "M": 12 * 3600, } )
Functions ¶
func CanDecodeContentEncoding ¶ added in v1.9.0
CanDecodeContentEncoding reports whether every coding of a Content-Encoding header value is supported by NewContentDecoder. An empty value and identity are always decodable.
func CheckNilField ¶
CheckNilField check if a struct has a nil field if allowNoPointerField is false, it also check if fields are all pointers if param object is not a struct , return nil
func CheckStaticFile ¶
CheckStaticFile check local file
func CipherSuiteTextForOpenSSL ¶ added in v1.9.0
CipherSuiteTextForOpenSSL returns the OpenSSL-style name of given cipher suite
func ConfPathProc ¶
ConfPathProc return path of config file
Params:
- confPath: origin path for config file
- confRoot: root path of ALL config
Returns:
the final path of config file (1) path starts with "/", it's absolute path, return path untouched (2) else, it's relative path, return path.Join(confRoot, path)
func CopyWithoutBuffer ¶
CopyWithoutBuffer mimic the behavior of io.Copy.
func DecodeContentEncoding ¶ added in v1.8.9
DecodeContentEncoding decodes data according to the HTTP Content-Encoding header value, e.g. for a parse-only copy of a complete response body.
The function fails open: an unknown encoding, an undecodable payload or one that decodes beyond the configured body buffer size returns the input bytes unchanged together with the error, so a caller that only wants the decoded form for its own parsing never breaks the request path.
func FormatAsPrometheusLabelValue ¶ added in v1.8.3
func GetConnFile ¶
GetConnFile get a copy of underlying os.File of tcp conn
func GetTCPConn ¶
GetTCPConn returns underlying TCPConn of given conn.
func GetVipPort ¶
GetVipPort return vip and port for given conn
func GetsockoptMultiByte ¶ added in v1.6.0
GetsockoptMultiByte returns the value of the socket option opt for the socket associated with fd at the given socket level.
func LoadJsonFile ¶
LoadJsonFile loads json content from file, unmarshal to jsonObject. check if all field is set if checkNilPointer is true check if any field is not pointer type if allowNoPointerField is false
func NativeUint16 ¶
func NewContentDecoder ¶ added in v1.9.0
NewContentDecoder returns a streaming decoder for the given Content-Encoding header value, reading the encoded bytes from r. A multi-value list is decoded in reverse application order.
An unsupported coding returns an error so the caller can fall back to passing the encoded bytes through untouched.
func ParseIpAndPort ¶
ParseIpAndPort return parsed ip address
func ParseTime ¶ added in v1.2.0
ParseTime returns a time in UTC+0 time zone. Note: currently, we do not use time.LoadLocation func, because it has two issues: 1. abusing opening files: https://github.com/golang/go/issues/24844 2. the version of zone info file in all machines may differ.
func ParseTimeOfDay ¶ added in v1.2.0
ParseTimeOfDay parser time string of a day timeStr: hhmmssZ, Z represents timezone return parsed time and offset of timezone
func SupportedContentEncodings ¶ added in v1.9.0
func SupportedContentEncodings() []string
SupportedContentEncodings returns the codings accepted by NewContentDecoder and CanDecodeContentEncoding, in preference order.
func VersionTextForOpenSSL ¶ added in v1.9.0
VersionTextForOpenSSL returns the OpenSSL-style text of given tls version
Types ¶
type AddressFetcher ¶
type AddressFetcher interface {
// RemoteAddr returns the remote network address.
RemoteAddr() net.Addr
// LocalAddr returns the local network address.
LocalAddr() net.Addr
// VirtualAddr returns the virtual network address.
VirtualAddr() net.Addr
// BalancerAddr return the balancer network address. May be nil.
BalancerAddr() net.Addr
}
AddressFetcher is the interface that group the address related method.
type CloseWriter ¶
type CloseWriter interface {
CloseWrite() error
}
CloseWriter is the interface that wraps the basic CloseWrite method.
type ConnFetcher ¶
ConnFetcher is the interface that wrap the GetNetConn
type FixedPool ¶
type FixedPool struct {
// contains filtered or unexported fields
}
func NewFixedPool ¶
type MockHandler ¶
A MockHandler is an handler to process established conn on server side
type MockServer ¶
type MockServer struct {
Listener net.Listener
// optional fields for tls server
TLS *tls.Config
Config *http.Server
// optional fields for tcp server
Handler MockHandler
}
A MockServer is an tls/tcp server listening on a system-chosen port on the local loopback interface, for use in end-to-end tests.
func NewUnstartedServer ¶
func NewUnstartedServer(handler interface{}) *MockServer
NewUnstartedServer returns a new Server but doesn't start it. After changing its configuration, the caller should call StartTLS. The caller should call Close when finished, to shut it down.
func (*MockServer) Close ¶
func (s *MockServer) Close()
Close shuts down the server and blocks until all outstanding requests on this server have completed.
func (*MockServer) CloseClientConnections ¶
func (s *MockServer) CloseClientConnections()
CloseClientConnections closes any currently open HTTP connections to the test Server.
func (*MockServer) StartTCP ¶
func (s *MockServer) StartTCP()
StartTCP starts TCP on a server from NewUnstartedServer.
func (*MockServer) StartTLS ¶
func (s *MockServer) StartTLS()
StartTLS starts TLS on a server from NewUnstartedServer.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package crypto implements decrypt-only support for the field-level encrypted config values produced by the control plane at export time (see docs/zh_cn/sys_design/config_file_field_encryption.md).
|
Package crypto implements decrypt-only support for the field-level encrypted config values produced by the control plane at export time (see docs/zh_cn/sys_design/config_file_field_encryption.md). |
|
Native (and fast) implementation of Austin Appleby's MurmurHash3.
|
Native (and fast) implementation of Austin Appleby's MurmurHash3. |