# eureka-client **Repository Path**: wxlao/eureka-client ## Basic Information - **Project Name**: eureka-client - **Description**: Eureka客户端Go封装 - **Primary Language**: Go - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2019-12-10 - **Last Updated**: 2022-04-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # eureka-client #### 介绍 Eureka客户端Go封装 依赖:https://github.com/HikoQiu/go-eureka-client; https://github.com/HikoQiu/go-feign; #### 软件架构 封装了 go-eureka-client 和 go-feign #### 安装教程 go get -u gitee.com/wxlao/eureka-client #### 使用说明 ```go // 引入包 import "gitee.com/wxlao/eureka-client" // 新客户端 client1 := eureka.New("post-service", "http://192.168.1.100:1111/eureka,http://192.168.1.101:1111/eureka"); client2 := eureka.New( "post-service", "http://192.168.1.100:1111/eureka", eureka.WithPort(80), eureka.WithIP("192.168.1.102"), eureka.WithLogFunc(func(level int, format string, a ...interface{}) { var logFunc *zerolog.Event switch level { case 1: logFunc = log.Debug() case 2: logFunc = log.Info() case 3: logFunc = log.Error() } if logFunc != nil { funcName, file, line, _ := runtime.Caller(2) fullFuncName := runtime.FuncForPC(funcName).Name() arr := strings.Split(fullFuncName, "/") arrFile := strings.Split(file, "/") logFunc.Str("file", arrFile[len(arrFile)-1]).Int("line", line).Str("func", arr[len(arr)-1]).Msgf(format, a...) } }) ); // 调用服务 resp, err := client1.Get("http://post-service/api/v1/list-post") resp, err := client2.Post("http://post-service/api/v1/add", body) ```