Documentation ¶
Index ¶
- Constants
- Variables
- func GetHostnameByIP(ip string) (hostname string)
- func GetLocalIP() (ip string)
- func NewServiceCache(timeout time.Duration) *serviceCache
- func NowStr() string
- type ActionType
- type AppInfo
- type Application
- type Applications
- type Client
- func (c *Client) Deregister() error
- func (c *Client) GetAppInstanceByID(appID string, instanceID string) (Instance, error)
- func (c *Client) GetAppInstanceSVip(svips string) (Applications, error)
- func (c *Client) GetAppInstanceVip(vip string) (Applications, error)
- func (c *Client) GetAppInstances(appID string) (Application, error)
- func (c *Client) GetApps() (Applications, error)
- func (c *Client) GetOwnAppInstance() (Instance, error)
- func (c *Client) GetOwnAppInstances() (Application, error)
- func (c *Client) Register() error
- func (c *Client) Request(serviceName string, req *http.Request) ([]byte, error)
- func (c *Client) RoundTrip(r *http.Request) (*http.Response, error)
- func (c *Client) UpdateOwnAppInstanceMetadata(value map[string]string) error
- func (c *Client) UpdateOwnAppInstanceStatus(status InstanceStatus) error
- type DataCenterInfo
- type DataCenterInfoName
- type Instance
- type InstanceStatus
- type LeaseInfo
- type MaxRetriesExceeded
- type Port
Constants ¶
View Source
const ( ADDED ActionType = "ADDED" MODIFIED = "MODIFIED" DELETED = "DELETED" )
View Source
const ( Netflix DataCenterInfoName = "Netflix" Amazon = "Amazon" MyOwn = "MyOwn" )
Variables ¶
View Source
var RETRIES = 3
Functions ¶
Types ¶
type ActionType ¶
type ActionType string
type Application ¶
type Applications ¶
type Applications struct { AppsHashCode string `json:"apps__hashcode" xml:"apps__hashcode"` VersionDelta string `json:"versions__delta" xml:"versions__delta"` Application []Application `json:"application,omitempty" xml:"application,omitempty"` }
type Client ¶
eureka客户端
func (*Client) Deregister ¶
下线 DELETE {{url}}/eureka/apps/{{appID}}/{{instanceID}}
func (*Client) GetAppInstanceByID ¶
查询指定服务实例
func (*Client) GetAppInstanceSVip ¶
func (c *Client) GetAppInstanceSVip(svips string) (Applications, error)
查询svip下的实例 GET {{url}}/eureka/svips/{{svipAddress}}
func (*Client) GetAppInstanceVip ¶
func (c *Client) GetAppInstanceVip(vip string) (Applications, error)
查询vip下的实例 GET {{url}}/eureka/vips/{{vipAddress}}
func (*Client) GetAppInstances ¶
func (c *Client) GetAppInstances(appID string) (Application, error)
获取指定服务的实例 GET {{url}}/eureka/apps/{{appID}}
func (*Client) GetApps ¶
func (c *Client) GetApps() (Applications, error)
获取所有实例 GET {{url}}/eureka/apps
func (*Client) GetOwnAppInstance ¶
查询自己注册的服务信息 GET {{url}}/eureka/apps/{{appID}}/{{appID}}:{{instanceID}}
func (*Client) GetOwnAppInstances ¶
func (c *Client) GetOwnAppInstances() (Application, error)
查询同服务的所有实例 GET {{url}}/eureka/apps/{{appID}}
func (*Client) UpdateOwnAppInstanceMetadata ¶
更新元数据 {{url}}/eureka/v2/apps/{{appID}}/{{instanceID}}/metadata?key=value
func (*Client) UpdateOwnAppInstanceStatus ¶
func (c *Client) UpdateOwnAppInstanceStatus(status InstanceStatus) error
更改自己实例状态 PUT {{url}}/eureka/apps/{{appID}}/{{instanceID}}/status?value=OUT_OF_SERVICE
type DataCenterInfo ¶
type DataCenterInfoName ¶
type DataCenterInfoName string
type Instance ¶
type Instance struct { InstanceID string `json:"instanceId" xml:"instanceId"` App string `json:"app" xml:"app"` HostName string `json:"hostName" xml:"hostName"` IpAddr string `json:"ipAddr" xml:"ipAddr"` Sid string `json:"sid" xml:"sid"` //default:na HomePageUrl string `json:"homePageUrl" xml:"homePageUrl"` StatusPageUrl string `json:"statusPageUrl" xml:"statusPageUrl"` HealthCheckUrl string `json:"healthCheckUrl" xml:"healthCheckUrl"` VipAddress string `json:"vipAddress" xml:"vipAddress"` SecureVipAddress string `json:"secureVipAddress" xml:"secureVipAddress"` CountryId int `json:"countryId" xml:"countryId"` // US:1 DataCenterInfo DataCenterInfo `json:"dataCenterInfo" xml:"dataCenterInfo"` Status InstanceStatus `json:"status" xml:"status"` Overriddenstatus InstanceStatus `json:"overriddenstatus" xml:"overriddenstatus"` LeaseInfo LeaseInfo `json:"leaseInfo" xml:"leaseInfo"` IsCoordinatingDiscoveryServer bool `json:"isCoordinatingDiscoveryServer" xml:"isCoordinatingDiscoveryServer"` LastUpdatedTimestamp int64 `json:"lastUpdatedTimestamp" xml:"lastUpdatedTimestamp"` LastDirtyTimestamp int64 `json:"lastDirtyTimestamp" xml:"lastDirtyTimestamp"` ActionType ActionType `json:"actionType" xml:"actionType"` Port Port `json:"port" xml:"port"` //7001 $7001 @enabled=true SecurePort Port `json:"securePort" xml:"securePort"` //7002 $7002 @enabled=false Metadata interface{} `json:"metadata,omitempty" xml:"metadata"` }
type InstanceStatus ¶
type InstanceStatus string
const ( UP InstanceStatus = "UP" DOWN InstanceStatus = "DOWN" STARTING InstanceStatus = "STARTING" OUT_OF_SERVICE InstanceStatus = "OUT_OF_SERVICE" UNKNOWN InstanceStatus = "UNKNOWN" )
type LeaseInfo ¶
type LeaseInfo struct { RenewalIntervalInSecs int `json:"renewalIntervalInSecs" xml:"renewalIntervalInSecs"` //30 DurationInSecs int `json:"durationInSecs" xml:"durationInSecs"` //90 RegistrationTimestamp int64 `json:"registrationTimestamp" xml:"registrationTimestamp"` LastRenewalTimestamp int64 `json:"lastRenewalTimestamp" xml:"lastRenewalTimestamp"` EvictionTimestamp int64 `json:"evictionTimestamp" xml:"evictionTimestamp"` ServiceUpTimestamp int64 `json:"serviceUpTimestamp" xml:"serviceUpTimestamp"` }
type MaxRetriesExceeded ¶
MaxRetriesExceeded is an error that occurs when the maximum amount of retries is exceeded.
func (MaxRetriesExceeded) Error ¶
func (err MaxRetriesExceeded) Error() string
Click to show internal directories.
Click to hide internal directories.