Documentation
¶
Index ¶
- func Heartbeat(zone, app, instanceID string) error
- func Register(zone, app string, instance *Instance) error
- func UnRegister(zone, app, instanceID string) error
- type Application
- type Applications
- type Client
- type Config
- type DataCenterInfo
- type DataCenterMetadata
- type Eureka
- type Instance
- type LeaseInfo
- type Port
- type Url
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Heartbeat ¶
Heartbeat 发送心跳 PUT /eureka/v2/apps/appID/instanceID
func Register ¶
Register 注册实例 POST /eureka/v2/apps/appID
Types ¶
type Application ¶
type Application struct {
Name string `xml:"name" json:"name"`
Instances []Instance `xml:"instance" json:"instance"`
}
Application eureka服务端注册的app
type Applications ¶
type Applications struct {
VersionsDelta string `xml:"versions__delta,omitempty" json:"versions__delta,omitempty"`
AppsHashcode string `xml:"apps__hashcode,omitempty" json:"apps__hashcode,omitempty"`
Applications []Application `xml:"application,omitempty" json:"application,omitempty"`
}
Applications eureka服务端注册的apps
func Refresh ¶
func Refresh(zone string) (*Applications, error)
Refresh 查询所有服务实例 GET /eureka/v2/apps
type Client ¶
type Client struct {
Running bool
Config *Config
// eureka服务中注册的应用
Applications *Applications
// contains filtered or unexported fields
}
Client eureka客户端
type Config ¶
type Config struct {
// eureka服务端地址
DefaultZone string
// 心跳间隔,默认30s
RenewalIntervalInSecs int
// 获取服务列表间隔,默认15s
RegistryFetchIntervalSeconds int
// 过期间隔,默认90s
DurationInSecs int
// 应用名称
App string
// 端口
Port int
Metadata map[string]interface{}
// contains filtered or unexported fields
}
Config eureka客户端配置
type DataCenterInfo ¶
type DataCenterInfo struct {
Name string `xml:"name" json:"name"`
Class string `xml:"class,attr" json:"@class"`
Metadata *DataCenterMetadata `xml:"metadata,omitempty" json:"metadata,omitempty"`
}
DataCenterInfo 数据中心信息
type DataCenterMetadata ¶
type DataCenterMetadata struct {
AmiLaunchIndex string `xml:"ami-launch-index,omitempty" json:"ami-launch-index,omitempty"`
LocalHostname string `xml:"local-hostname,omitempty" json:"local-hostname,omitempty"`
AvailabilityZone string `xml:"availability-zone,omitempty" json:"availability-zone,omitempty"`
InstanceID string `xml:"instance-id,omitempty" json:"instance-id,omitempty"`
PublicIpv4 string `xml:"public-ipv4,omitempty" json:"public-ipv4,omitempty"`
PublicHostname string `xml:"public-hostname,omitempty" json:"public-hostname,omitempty"`
AmiManifestPath string `xml:"ami-manifest-path,omitempty" json:"ami-manifest-path,omitempty"`
LocalIpv4 string `xml:"local-ipv4,omitempty" json:"local-ipv4,omitempty"`
Hostname string `xml:"hostname,omitempty" json:"hostname,omitempty"`
AmiID string `xml:"ami-id,omitempty" json:"ami-id,omitempty"`
InstanceType string `xml:"instance-type,omitempty" json:"instance-type,omitempty"`
}
DataCenterMetadata 数据中心信息元数据
type Eureka ¶
type Eureka struct {
// contains filtered or unexported fields
}
type Instance ¶
type Instance struct {
HostName string `xml:"hostName" json:"hostName"`
HomePageURL string `xml:"homePageUrl,omitempty" json:"homePageUrl,omitempty"`
StatusPageURL string `xml:"statusPageUrl" json:"statusPageUrl"`
HealthCheckURL string `xml:"healthCheckUrl,omitempty" json:"healthCheckUrl,omitempty"`
App string `xml:"app" json:"app"`
IPAddr string `xml:"ipAddr" json:"ipAddr"`
VipAddress string `xml:"vipAddress" json:"vipAddress"`
SecureVipAddress string `xml:"secureVipAddress,omitempty" json:"secureVipAddress,omitempty"`
Status string `xml:"status" json:"status"`
Port *Port `xml:"port,omitempty" json:"port,omitempty"`
SecurePort *Port `xml:"securePort,omitempty" json:"securePort,omitempty"`
DataCenterInfo *DataCenterInfo `xml:"dataCenterInfo" json:"dataCenterInfo"`
LeaseInfo *LeaseInfo `xml:"leaseInfo,omitempty" json:"leaseInfo,omitempty"`
Metadata map[string]interface{} `xml:"metadata,omitempty" json:"metadata,omitempty"`
IsCoordinatingDiscoveryServer string `xml:"isCoordinatingDiscoveryServer,omitempty" json:"isCoordinatingDiscoveryServer,omitempty"`
LastUpdatedTimestamp string `xml:"lastUpdatedTimestamp,omitempty" json:"lastUpdatedTimestamp,omitempty"`
LastDirtyTimestamp string `xml:"lastDirtyTimestamp,omitempty" json:"lastDirtyTimestamp,omitempty"`
ActionType string `xml:"actionType,omitempty" json:"actionType,omitempty"`
OverriddenStatus string `xml:"overriddenstatus,omitempty" json:"overriddenstatus,omitempty"`
CountryID int `xml:"countryId,omitempty" json:"countryId,omitempty"`
InstanceID string `xml:"instanceId,omitempty" json:"instanceId,omitempty"`
}
Instance 服务实例
type LeaseInfo ¶
type LeaseInfo struct {
RenewalIntervalInSecs int `xml:"renewalIntervalInSecs,omitempty" json:"renewalIntervalInSecs,omitempty"`
DurationInSecs int `xml:"durationInSecs,omitempty" json:"durationInSecs,omitempty"`
}
LeaseInfo 续约信息
Source Files
¶
- api.go
- client.go
- config.go
- eureka.go
- util.go
Click to show internal directories.
Click to hide internal directories.