Documentation ¶
Overview ¶
Package net provides net functionality for vald's network connection
Package net provides net functionality for vald's network connection ¶
Package tcp provides tcp option
Index ¶
- Variables
- func IsLocal(host string) bool
- func JoinHostPort(host string, port uint16) string
- func LoadLocalIP() string
- func Parse(addr string) (host string, port uint16, isLocal, isIPv4, isIPv6 bool, err error)
- func ScanPorts(ctx context.Context, start, end uint16, host string) (ports []uint16, err error)
- func SplitHostPort(hostport string) (host string, port uint16, err error)
- type Conn
- type Dialer
- type DialerOption
- func WithCache(c cache.Cache) DialerOption
- func WithDNSCacheExpiration(dur string) DialerOption
- func WithDNSRefreshDuration(dur string) DialerOption
- func WithDialerFallbackDelay(dur string) DialerOption
- func WithDialerKeepAlive(dur string) DialerOption
- func WithDialerTimeout(dur string) DialerOption
- func WithDisableDNSCache() DialerOption
- func WithDisableDialerDualStack() DialerOption
- func WithEnableDNSCache() DialerOption
- func WithEnableDialerDualStack() DialerOption
- func WithErrGroup(eg errgroup.Group) DialerOption
- func WithSocketFlag(flg control.SocketFlag) DialerOption
- func WithTLS(cfg *tls.Config) DialerOption
- type ListenConfig
- type Listener
- type NetworkType
- type Resolver
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultResolver is an alias of net.DefaultResolver. DefaultResolver = net.DefaultResolver // Listen is an alias of net.Listen. Listen = net.Listen // IPv4 is an alias of net.IPv4. IPv4 = net.IPv4 )
Functions ¶
func JoinHostPort ¶ added in v1.0.2
JoinHostPort joins the host/IP address and the port number,
func Parse ¶
Parse parses the hostname, IPv4 or IPv6 address and return the hostname/IP, port number, whether the address is local IP and IPv4 or IPv6, and any parsing error occurred. The address should contains the port number, otherwise an error will return.
func ScanPorts ¶
ScanPorts scans the given range of port numbers from the host (inclusively), and return the list of ports that can be connected through TCP, or any error occurred.
func SplitHostPort ¶
SplitHostPort splits the address, and return the host/IP address and the port number, and any error occurred. If it is the loopback address, it will return the loopback address and corresponding port number. IPv6 loopback address is not supported yet. For more information, please read https://github.com/vdaas/vald/projects/3#card-43504189
Types ¶
type Dialer ¶
type Dialer interface { GetDialer() func(ctx context.Context, network, addr string) (Conn, error) StartDialerCache(ctx context.Context) DialContext(ctx context.Context, network, address string) (Conn, error) }
Dialer is an interface to get the dialer instance to connect to an address.
func NewDialer ¶ added in v1.0.3
func NewDialer(opts ...DialerOption) (der Dialer, err error)
NewDialer initialize and return the dialer instance.
type DialerOption ¶ added in v1.0.3
type DialerOption func(*dialer)
DialerOption represent the functional option for dialer.
func WithCache ¶ added in v1.0.3
func WithCache(c cache.Cache) DialerOption
WithCache returns the functional option to set the cache.
func WithDNSCacheExpiration ¶ added in v1.0.3
func WithDNSCacheExpiration(dur string) DialerOption
WithDNSCacheExpiration returns the functional option to set the DNSCacheExpiration.
func WithDNSRefreshDuration ¶ added in v1.0.3
func WithDNSRefreshDuration(dur string) DialerOption
WithDNSRefreshDuration returns the functional option to set the DNSRefreshDuration.
func WithDialerFallbackDelay ¶ added in v1.0.3
func WithDialerFallbackDelay(dur string) DialerOption
WithDialerFallbackDelay returns the functional option to set the DialerFallbackDelay.
func WithDialerKeepAlive ¶ added in v1.0.3
func WithDialerKeepAlive(dur string) DialerOption
WithDialerKeepAlive returns the functional option to set the DialerKeepAlive.
func WithDialerTimeout ¶ added in v1.0.3
func WithDialerTimeout(dur string) DialerOption
WithDialerTimeout returns the functional option to set the DialerTimeout.
func WithDisableDNSCache ¶ added in v1.0.3
func WithDisableDNSCache() DialerOption
WithDisableDNSCache returns the functional option to disable DNSCache.
func WithDisableDialerDualStack ¶ added in v1.0.3
func WithDisableDialerDualStack() DialerOption
WithDisableDialerDualStack returns the functional option to disable DialerDualStack.
func WithEnableDNSCache ¶ added in v1.0.3
func WithEnableDNSCache() DialerOption
WithEnableDNSCache returns the functional option to enable DNSCache.
func WithEnableDialerDualStack ¶ added in v1.0.3
func WithEnableDialerDualStack() DialerOption
WithEnableDialerDualStack returns the functional option to enable DialerDualStack.
func WithErrGroup ¶ added in v1.0.3
func WithErrGroup(eg errgroup.Group) DialerOption
func WithSocketFlag ¶ added in v1.0.3
func WithSocketFlag(flg control.SocketFlag) DialerOption
WithSocketFlag returns the functional option to set the socket options.
func WithTLS ¶ added in v1.0.3
func WithTLS(cfg *tls.Config) DialerOption
WithTLS returns the functional option to set the DialerTLS.
type ListenConfig ¶
type ListenConfig = net.ListenConfig
ListenConfig is an alias of net.ListenConfig.
type NetworkType ¶ added in v1.0.3
type NetworkType uint
const ( Unknown NetworkType = iota UNIX UNIXGRAM UNIXPACKET ICMP ICMP6 IGMP TCP TCP4 TCP6 UDP UDP4 UDP6 )
func NetworkTypeFromString ¶ added in v1.0.3
func NetworkTypeFromString(str string) NetworkType
func (NetworkType) String ¶ added in v1.0.3
func (n NetworkType) String() string
Directories ¶
Path | Synopsis |
---|---|
Package control provides network socket option Package control provides network socket option
|
Package control provides network socket option Package control provides network socket option |
Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc
|
Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc Package grpc provides generic functionality for grpc |
codes
Package codes provides status codes of grpc
|
Package codes provides status codes of grpc |
credentials
Package credentials provides generic functionality for grpc credentials setting
|
Package credentials provides generic functionality for grpc credentials setting |
errdetails
Package errdetails provides error detail for grpc status
|
Package errdetails provides error detail for grpc status |
interceptor/server/logging
Package logging provides gRPC interceptors for access logging
|
Package logging provides gRPC interceptors for access logging |
interceptor/server/recover
Package recover provides gRPC interceptors for recovery
|
Package recover provides gRPC interceptors for recovery |
interceptor/server/trace
Package trace provides gRPC interceptors for traces
|
Package trace provides gRPC interceptors for traces |
keepalive
Package keepalive provides grpc keepalive configuration
|
Package keepalive provides grpc keepalive configuration |
metric
Package metric provides metrics functions for grpc Package metric provides metrics functions for grpc Package metric provides metrics functions for grpc Package metric provides metrics functions for grpc
|
Package metric provides metrics functions for grpc Package metric provides metrics functions for grpc Package metric provides metrics functions for grpc Package metric provides metrics functions for grpc |
pool
Package pool provides grpc connection pool client Package pool provides grpc connection pool client
|
Package pool provides grpc connection pool client Package pool provides grpc connection pool client |
proto
Package proto provides proto file logic
|
Package proto provides proto file logic |
reflection
Package reflection provides grpc reflection for providing grpc server proto specs
|
Package reflection provides grpc reflection for providing grpc server proto specs |
status
Package status provides statuses and errors returned by grpc handler functions
|
Package status provides statuses and errors returned by grpc handler functions |
types
Package types provides alias of protobuf library types
|
Package types provides alias of protobuf library types |
http
|
|
dump
Package dump provides http request/response dump logic
|
Package dump provides http request/response dump logic |
metrics
Package metrics provides pprof profiler handler
|
Package metrics provides pprof profiler handler |
middleware
Package middleware provides rest.Func Middleware Package routing provides implementation of Go API for routing http Handler wrapped by rest.Func Package middleware provides rest.Func Middleware
|
Package middleware provides rest.Func Middleware Package routing provides implementation of Go API for routing http Handler wrapped by rest.Func Package middleware provides rest.Func Middleware |
rest
Package rest provides REST API common logic & variable
|
Package rest provides REST API common logic & variable |
transport
Package transport provides http transport roundtrip option Package transport provides http transport roundtrip option Copyright (C) 2019-2021 vdaas.org vald team <vald@vdaas.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
Package transport provides http transport roundtrip option Package transport provides http transport roundtrip option Copyright (C) 2019-2021 vdaas.org vald team <vald@vdaas.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. |