Documentation ¶
Index ¶
- Constants
- type ClientConfig
- type ClientOption
- func WithAccessKey(accessKey string) ClientOption
- func WithBeatInterval(beatInterval int64) ClientOption
- func WithCacheDir(cacheDir string) ClientOption
- func WithEndpoint(endpoint string) ClientOption
- func WithLogDir(logDir string) ClientOption
- func WithLogLevel(logLevel string) ClientOption
- func WithMaxAge(maxAge int64) ClientOption
- func WithNamespaceId(namespaceId string) ClientOption
- func WithNotLoadCacheAtStart(notLoadCacheAtStart bool) ClientOption
- func WithOpenKMS(openKMS bool) ClientOption
- func WithPassword(password string) ClientOption
- func WithRegionId(regionId string) ClientOption
- func WithRotateTime(rotateTime string) ClientOption
- func WithSecretKey(secretKey string) ClientOption
- func WithTimeoutMs(timeoutMs uint64) ClientOption
- func WithUpdateCacheWhenEmpty(updateCacheWhenEmpty bool) ClientOption
- func WithUpdateThreadNum(updateThreadNum int) ClientOption
- func WithUsername(username string) ClientOption
- type ServerConfig
- type ServerOption
Constants ¶
View Source
const ( KEY_USERNAME = "username" KEY_PASSWORD = "password" KEY_ENDPOINT = "endpoint" KEY_NAME_SPACE = "namespace" KEY_ACCESS_KEY = "accessKey" KEY_SECRET_KEY = "secretKey" KEY_SERVER_ADDR = "serverAddr" KEY_CONTEXT_PATH = "contextPath" KEY_ENCODE = "encode" KEY_DATA_ID = "dataId" KEY_GROUP = "group" KEY_TENANT = "tenant" KEY_DESC = "desc" KEY_APP_NAME = "appName" KEY_CONTENT = "content" KEY_TIMEOUT_MS = "timeoutMs" KEY_LISTEN_INTERVAL = "listenInterval" KEY_SERVER_CONFIGS = "serverConfigs" KEY_CLIENT_CONFIG = "clientConfig" KEY_TOKEN = "token" KEY_ACCESS_TOKEN = "accessToken" KEY_TOKEN_TTL = "tokenTtl" KEY_GLOBAL_ADMIN = "globalAdmin" KEY_TOKEN_REFRESH_WINDOW = "tokenRefreshWindow" WEB_CONTEXT = "/nacos" CONFIG_BASE_PATH = "/v1/cs" CONFIG_PATH = CONFIG_BASE_PATH + "/configs" CONFIG_LISTEN_PATH = CONFIG_BASE_PATH + "/configs/listener" SERVICE_BASE_PATH = "/v1/ns" SERVICE_PATH = SERVICE_BASE_PATH + "/instance" SERVICE_INFO_PATH = SERVICE_BASE_PATH + "/service" SERVICE_SUBSCRIBE_PATH = SERVICE_PATH + "/list" NAMESPACE_PATH = "/v1/console/namespaces" SPLIT_CONFIG = string(rune(1)) SPLIT_CONFIG_INNER = string(rune(2)) KEY_LISTEN_CONFIGS = "Listening-Configs" KEY_SERVICE_NAME = "serviceName" KEY_IP = "ip" KEY_PORT = "port" KEY_WEIGHT = "weight" KEY_ENABLE = "enable" KEY_HEALTHY = "healthy" KEY_METADATA = "metadata" KEY_CLUSTER_NAME = "clusterName" KEY_CLUSTER = "cluster" KEY_BEAT = "beat" KEY_DOM = "dom" DEFAULT_CONTEXT_PATH = "/nacos" CLIENT_VERSION = "Nacos-Go-Client:v1.0.1" REQUEST_DOMAIN_RETRY_TIME = 3 SERVICE_INFO_SPLITER = "@@" CONFIG_INFO_SPLITER = "@@" DEFAULT_NAMESPACE_ID = "public" DEFAULT_GROUP = "DEFAULT_GROUP" NAMING_INSTANCE_ID_SPLITTER = "#" DefaultClientErrorCode = "SDK.NacosError" DEFAULT_SERVER_SCHEME = "http" )
View Source
const ( HEART_BEAT_TIMEOUT = "preserved.heart.beat.timeout" IP_DELETE_TIMEOUT = "preserved.ip.delete.timeout" HEART_BEAT_INTERVAL = "preserved.heart.beat.interval" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConfig ¶
type ClientConfig struct { TimeoutMs uint64 //timeout for requesting Nacos server, default value is 10000ms ListenInterval uint64 //Deprecated BeatInterval int64 //the time interval for sending beat to server,default value is 5000ms NamespaceId string //the namespaceId of Nacos Endpoint string //the endpoint for get Nacos server addresses RegionId string //the regionId for kms AccessKey string //the AccessKey for kms SecretKey string //the SecretKey for kms OpenKMS bool //it's to open kms,default is false. https://help.aliyun.com/product/28933.html CacheDir string //the directory for persist nacos service info,default value is current path UpdateThreadNum int //the number of gorutine for update nacos service info,default value is 20 NotLoadCacheAtStart bool //not to load persistent nacos service info in CacheDir at start time UpdateCacheWhenEmpty bool //update cache when get empty service instance from server Username string //the username for nacos auth Password string //the password for nacos auth LogDir string //the directory for log, default is current path RotateTime string //the rotate time for log, eg: 30m, 1h, 24h, default is 24h MaxAge int64 //the max age of a log file, default value is 3 LogLevel string //the level of log, it's must be debug,info,warn,error, default value is info }
func NewClientConfig ¶ added in v1.0.4
func NewClientConfig(opts ...ClientOption) *ClientConfig
type ClientOption ¶ added in v1.0.4
type ClientOption func(*ClientConfig)
ClientOption ...
func WithAccessKey ¶ added in v1.0.4
func WithAccessKey(accessKey string) ClientOption
WithAccessKey ...
func WithBeatInterval ¶ added in v1.0.4
func WithBeatInterval(beatInterval int64) ClientOption
WithBeatInterval ...
func WithCacheDir ¶ added in v1.0.4
func WithCacheDir(cacheDir string) ClientOption
WithCacheDir ...
func WithEndpoint ¶ added in v1.0.4
func WithEndpoint(endpoint string) ClientOption
WithEndpoint ...
func WithLogLevel ¶ added in v1.0.4
func WithLogLevel(logLevel string) ClientOption
WithLogLevel ...
func WithNamespaceId ¶ added in v1.0.4
func WithNamespaceId(namespaceId string) ClientOption
WithNamespaceId ...
func WithNotLoadCacheAtStart ¶ added in v1.0.4
func WithNotLoadCacheAtStart(notLoadCacheAtStart bool) ClientOption
WithNotLoadCacheAtStart ...
func WithPassword ¶ added in v1.0.4
func WithPassword(password string) ClientOption
WithPassword ...
func WithRegionId ¶ added in v1.0.4
func WithRegionId(regionId string) ClientOption
WithRegionId ...
func WithRotateTime ¶ added in v1.0.4
func WithRotateTime(rotateTime string) ClientOption
WithRotateTime ...
func WithSecretKey ¶ added in v1.0.4
func WithSecretKey(secretKey string) ClientOption
WithSecretKey ...
func WithTimeoutMs ¶ added in v1.0.4
func WithTimeoutMs(timeoutMs uint64) ClientOption
WithTimeoutMs ...
func WithUpdateCacheWhenEmpty ¶ added in v1.0.4
func WithUpdateCacheWhenEmpty(updateCacheWhenEmpty bool) ClientOption
WithUpdateCacheWhenEmpty ...
func WithUpdateThreadNum ¶ added in v1.0.4
func WithUpdateThreadNum(updateThreadNum int) ClientOption
WithUpdateThreadNum ...
func WithUsername ¶ added in v1.0.4
func WithUsername(username string) ClientOption
WithUsername ...
type ServerConfig ¶
type ServerConfig struct { Scheme string //the nacos server scheme ContextPath string //the nacos server contextpath IpAddr string //the nacos server address Port uint64 //the nacos server port }
func NewServerConfig ¶ added in v1.0.4
func NewServerConfig(ipAddr string, port uint64, opts ...ServerOption) *ServerConfig
type ServerOption ¶ added in v1.0.4
type ServerOption func(*ServerConfig)
ServerOption ...
func WithContextPath ¶ added in v1.0.4
func WithContextPath(contextPath string) ServerOption
WithContextPath set contextPath for server
func WithIpAddr ¶ added in v1.0.4
func WithIpAddr(ipAddr string) ServerOption
WithIpAddr set ip address for server
func WithPort ¶ added in v1.0.4
func WithPort(port string) ServerOption
WithPort set port for server
func WithScheme ¶ added in v1.0.4
func WithScheme(scheme string) ServerOption
WithScheme set Scheme for server
Click to show internal directories.
Click to hide internal directories.