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






张伯雨

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理
上一页 1 2 3 4 5 6 7 8 ··· 37 下一页

2017年9月1日

linux.go
摘要: func LockFile(file *os.File) error { return syscall.Flock(int(file.Fd()), syscall.LOCK_EX) } 阅读全文
posted @ 2017-09-01 10:51 张伯雨 阅读(153) 评论(0) 推荐(0)
 
procotol.go 源码阅读
摘要: import ( "bytes" "encoding/binary")const ( // 支持数据最大长度为 2 << 61 // DataLengthOfLenth = 8 // 支持数据最大长度为 2 << 30 DataLengthOfLenth = 4)//通讯协议处理,主要处理封包和解包的过程type Protocol struct { // ... 阅读全文
posted @ 2017-09-01 10:50 张伯雨 阅读(200) 评论(0) 推荐(0)
 
return_fun.go 源码阅读
摘要: // ***********************************************常用函数*************************************************** \\// API中生成返回结果的方法// OpAndToAndFrom[0]参数为空时,系统将指定与对端相同的操作符// OpAndToAndFrom[1]参数为空时,系统将指定与对端为接... 阅读全文
posted @ 2017-09-01 10:50 张伯雨 阅读(252) 评论(0) 推荐(0)
 
netData.go 阅读源码
摘要: package teleportimport (// "net")const ( // 返回成功 SUCCESS = 0 // 返回失败 FAILURE = -1 // 返回非法请求 LLLEGAL = -2)// 定义数据传输结构type NetData struct { // 消息体 Body interface{} // 操作代号 ... 阅读全文
posted @ 2017-09-01 10:39 张伯雨 阅读(279) 评论(0) 推荐(0)
 
conn.go 源码阅读
摘要: import ( "net")// 封装连接type Connect struct { // 标准包conn接口实例,继承该接口所有方法 net.Conn // 标记连接是否有效 Usable bool // 是否为短链接模式 Short bool // 专用写入数据缓存通道 WriteChan chan *NetData // 从连接循... 阅读全文
posted @ 2017-09-01 10:38 张伯雨 阅读(293) 评论(0) 推荐(0)
 
util.go 源码阅读
摘要: import ( "crypto/md5" "encoding/hex" "encoding/json" "fmt" "hash/crc32" "hash/fnv" "strconv")//string to hash//字符串转化为hash值 使用的是 IEEE func MakeHash(s string) string { const IE... 阅读全文
posted @ 2017-09-01 10:37 张伯雨 阅读(275) 评论(0) 推荐(0)
 
teeporxy.go
摘要: package mainimport ( "bytes" "crypto/tls" "flag" "fmt" "io" "io/ioutil" "math/rand" "net" "net/http" "net/http/httputil" "runtime" "time")// Console flags//参数解析var ... 阅读全文
posted @ 2017-09-01 10:36 张伯雨 阅读(252) 评论(0) 推荐(0)
 
sonyflake.go
摘要: // Package sonyflake implements Sonyflake, a distributed unique ID generator inspired by Twitter's Snowflake.//第一位为未使用(实际上也可作为long的符号位),接下来的41位为毫秒级时间,然后5位datacenter标识位,5位机器ID(并不算标识符,实际是为线程标识),然后12位该毫秒... 阅读全文
posted @ 2017-09-01 10:32 张伯雨 阅读(1257) 评论(0) 推荐(0)
 
segmenter.go
摘要: //Go中文分词package segoimport ( "bufio" "fmt" "log" "math" "os" "strconv" "strings" "unicode" "unicode/utf8")const ( minTokenFrequency = 2 // 仅从字典文件中读取大于等于此频率的分词)// 分词器结构体ty... 阅读全文
posted @ 2017-09-01 10:31 张伯雨 阅读(364) 评论(0) 推荐(0)
 
token.go
摘要: package sego// 字串类型,可以用来表达// 1. 一个字元,比如"中"又如"国", 英文的一个字元是一个词// 2. 一个分词,比如"中国"又如"人口"// 3. 一段文字,比如"中国有十三亿人口"type Text []byte// 一个分词type Token struct { // 分词的字串,这实际上是个字元数组 text []Text /... 阅读全文
posted @ 2017-09-01 10:31 张伯雨 阅读(425) 评论(0) 推荐(0)
 
上一页 1 2 3 4 5 6 7 8 ··· 37 下一页