- 博客(234)
- 资源 (1)
- 收藏
- 关注
原创 windows执行定时任务
命令中/tr 中 “python解释器位置 要执行的脚本位置”(都是绝对路径)python脚本内容中的路径最好也是绝对路径。立即执行定时任务(测试定时任务是否能跑通)/ tn 创建的任务名称。
2024-06-13 11:29:03
429
原创 golang连接数据库
configvar DnsDevConfInstance *DnsDevConfvar DnsDevConfInstanceOnceDo sync.Once// func SingleNewDnsDevConf() *DnsDevConf { if DnsDevConfInstance == nil { DnsDevConfInstanceOnceDo.Do(func() { DnsDevConfInstance = NewDnsDevConf() }) } return Dn
2022-05-10 17:30:18
1433
原创 net/http路由注册
package mainimport ( "context" "fmt" "log" "net/http" "os" "os/signal" "syscall")type HandlerStruct struct { content string}// HelloHandlerStruct Handler对象func (handler *HandlerStruct) ServeHTTP(w http.ResponseWriter, r *http.Request) { f
2022-05-07 16:13:57
873
原创 查看ens域名是否可注册
package testimport ( "encoding/json" "fmt" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "io/ioutil" "log" "net/http" "strings" "testing")func TestNameHash(t *testing.T) { res, err := PostEns("wangbin.eth"
2022-05-06 15:11:19
806
原创 golang grpc服务
.proto协议文件// 版本syntax = "proto3";// 指定包名package protoser;// 文件生成位置option go_package = "./protoser";//service ListenService { rpc ListenServerEth (Req) returns (Res) {}}message Req { string addr =1;}message Res { string msg = 1;}mak
2022-05-05 15:30:22
212
原创 golang 单例
package serverimport "sync"type ListenServer struct {}func NewListenServer() *ListenServer { return &ListenServer{}}//var listenServerInstance *ListenServer//var listenServerMutex sync.Mutexvar listenServerInstanceOnceDo sync.Once// 单例
2022-04-27 15:42:14
200
原创 RSA 加密解密签名验签
apipackage v1// get请求import "github.com/gogf/gf/v2/frame/g"type GetKeyReq struct { g.Meta `path:"/get_key" method:"get" summary:"获取公钥" tags:"RSA"` Name string `json:"name" v:"required#账号" dc:"账号"`}type GetKeyRes struct { //g.Meta `mime:"text
2022-04-22 18:35:49
1389
原创 ECDSA签名算法
package mainimport ( "crypto/ecdsa" "crypto/elliptic" "crypto/rand" "crypto/sha256" "crypto/x509" "encoding/base64" "encoding/hex" "fmt" "math/big" "strings")// 生成公私钥func GenKeyPair() (privateKey string, publicKey string, e error) { // Gen
2022-04-22 15:23:29
992
原创 goframe框架jwt
service代码package service// gf-jwtimport ( "context" "firstproject/internal/model" jwt "github.com/gogf/gf-jwt/v2" "github.com/gogf/gf/v2/frame/g" "time")var authService *jwt.GfJWTMiddleware// 权限包管理func Auth() *jwt.GfJWTMiddleware { return a
2022-04-19 14:14:00
827
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人