• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • YouClaw
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






张伯雨

学习使人快乐
 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

随笔分类 -  gotcpproxy

 
proxy.go 源码阅读
摘要:package mainimport ( "net" "time")func initProxy() { pLog.Infof("Proxying %s -> %s\n", pConfig.Bind, pConfig.Backend) //输出服务地址 后端服务地址列表 server, err := net.Listen("tcp", pConfig.Bind) ... 阅读全文
posted @ 2017-09-01 10:20 张伯雨 阅读(376) 评论(0) 推荐(0)
balance.go 源码阅读
摘要:import ( //"fmt" "math/rand" "net" "stathat.com/c/consistent" "time")// BackendSvr Typetype BackendSvr struct { svrStr string isUp bool // is Up or Down failTimes int}v... 阅读全文
posted @ 2017-09-01 10:20 张伯雨 阅读(283) 评论(0) 推荐(0)
monitor.go 源码阅读
摘要:package mainimport ( "fmt" "net/http")// 查询监控信息的接口func statsHandler(w http.ResponseWriter, r *http.Request) { _str := "" for _, v := range pBackendSvrs { _str += fmt.Sprintf("Server... 阅读全文
posted @ 2017-09-01 10:19 张伯雨 阅读(332) 评论(0) 推荐(0)
log.go 源码阅读
摘要:package mainimport ( "github.com/Sirupsen/logrus" "os" "path/filepath")func initLogger() error { dirPath, _ := filepath.Abs(filepath.Dir(pConfig.Log.Path)) //获取日志文件目录 if _, err := os.S... 阅读全文
posted @ 2017-09-01 10:19 张伯雨 阅读(249) 评论(0) 推荐(0)
config.go 源码阅读
摘要:package mainimport ( "io/ioutil" "launchpad.net/goyaml")// ProxyConfig Typetype ProxyConfig struct { Bind string `yaml:"bind"` //代理服务监听端口 WaitQueueLen int `yaml:"wait_que... 阅读全文
posted @ 2017-09-01 10:18 张伯雨 阅读(243) 评论(0) 推荐(0)