1 Star 0 Fork 16

Ellan-bm/SIP协议

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
expires.go 541 Bytes
一键复制 编辑 原始数据 按行查看 历史
shallot 提交于 2020-04-05 12:24 +08:00 . 添加SIP协议的解析代码。
package sip
import (
"fmt"
"strconv"
)
// 消息或内容过期时间
type Expires struct {
value *int // 实际的值
}
func parseExpires(str string) (item Expires, err error) {
expires, err := strconv.Atoi(str)
if err != nil {
return
}
item = Expires{
value: &expires,
}
return
}
// 是否是注销请求
func (e Expires) IsRequestLogOut() bool {
return e.value != nil && *(e.value) == 0
}
// 字符串表达
func (e Expires) String() string {
if e.value == nil {
return ""
}
return fmt.Sprintf("%d", *(e.value))
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/ellan-bm/sip.git
git@gitee.com:ellan-bm/sip.git
ellan-bm
sip
SIP协议
master

搜索帮助