Skip to content

Commit

Permalink
feat(项目): 完成框架接入
Browse files Browse the repository at this point in the history
  • Loading branch information
storezhang committed Feb 18, 2023
1 parent 83548b6 commit 46814de
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 40 deletions.
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# 项目
[![编译状态](https://github.ruijc.com:20443/api/badges/pangum/pangu/status.svg)](https://github.ruijc.com:20443/pangum/pangu)
[![Golang质量](https://goreportcard.com/badge/github.com/pangum/pangu)](https://goreportcard.com/report/github.com/pangum/pangu)
![版本](https://img.shields.io/github/go-mod/go-version/pangum/pangu)
![仓库大小](https://img.shields.io/github/repo-size/pangum/pangu)
![最后提交](https://img.shields.io/github/last-commit/pangum/pangu)
![授权协议](https://img.shields.io/github/license/pangum/pangu)
![语言个数](https://img.shields.io/github/languages/count/pangum/pangu)
![最佳语言](https://img.shields.io/github/languages/top/pangum/pangu)
![星星个数](https://img.shields.io/github/stars/pangum/pangu?style=social)

项目介绍
# 宋慈
[![编译状态](https://github.ruijc.com:20443/api/badges/pangum/songci/status.svg)](https://github.ruijc.com:20443/pangum/songci)
[![Golang质量](https://goreportcard.com/badge/github.com/pangum/songci)](https://goreportcard.com/report/github.com/pangum/songci)
![版本](https://img.shields.io/github/go-mod/go-version/pangum/songci)
![仓库大小](https://img.shields.io/github/repo-size/pangum/songci)
![最后提交](https://img.shields.io/github/last-commit/pangum/songci)
![授权协议](https://img.shields.io/github/license/pangum/songci)
![语言个数](https://img.shields.io/github/languages/count/pangum/songci)
![最佳语言](https://img.shields.io/github/languages/top/pangum/songci)
![星星个数](https://img.shields.io/github/stars/pangum/songci?style=social)

一个Golang版本的签名及验证算法库,支持的签名算法有
- `子南`算法,一个类似于`腾讯云`的签名算法
- `Basic`基本认证

## 项目实践

Expand All @@ -33,4 +35,4 @@

本项目通过`Jetbrains开源许可IDE`编写源代码,特此感谢

[![Jetbrains图标](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=pangum/pangu)
[![Jetbrains图标](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=pangum/songci)
12 changes: 12 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package songci

import (
"time"
)

type config struct {
// 超时
Timeout time.Duration `json:"timeout" yaml:"timeout" xml:"timeout" toml:"timeout"`
// 子南算法
Zinan *zinan `json:"zinan" yaml:"zinan" xml:"zinan" toml:"zinan"`
}
11 changes: 7 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ module github.com/pangum/starter

go 1.18

require github.com/pangum/pangu v0.1.8
require (
github.com/goexl/songci v0.0.1
github.com/pangum/pangu v0.1.8
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
Expand All @@ -12,16 +15,16 @@ require (
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.11.0 // indirect
github.com/goexl/baozheng v0.0.1 // indirect
github.com/goexl/cryptor v0.0.4 // indirect
github.com/goexl/env v0.0.2 // indirect
github.com/goexl/exc v0.0.4 // indirect
github.com/goexl/exc v0.0.5 // indirect
github.com/goexl/gfx v0.1.0 // indirect
github.com/goexl/gox v0.0.9 // indirect
github.com/goexl/gox v0.2.1 // indirect
github.com/goexl/mengpo v0.1.9 // indirect
github.com/goexl/simaqian v0.1.3 // indirect
github.com/goexl/xiren v0.0.3 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/rs/xid v1.4.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions pangu.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package starter
package songci

import (
"github.com/pangum/pangu"
)

func init() {
pangu.New().Dependencies(
newAgent,
newSongci,
)
}
4 changes: 2 additions & 2 deletions pangu_config.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package starter
package songci

type panguConfig struct {
// TODO 加入自定义的配置
Songci config `json:"songci" yaml:"songci" xml:"songci" toml:"songci"`
}
35 changes: 35 additions & 0 deletions songci.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package songci

import (
"github.com/goexl/songci"
"github.com/pangum/pangu"
)

// Songci 入口封装,由于语言特性,最好是直接继承的方式,通过显示使用主入口来执行初始化流程
type Songci struct {
*songci.Songci
}

func newSongci(config *pangu.Config) (songci *Songci, err error) {
_config := new(panguConfig)
if err = config.Load(_config); nil != err {
return
}

songci = new(Songci)
songci.Songci = buildSongci(_config.Songci)

return
}

func buildSongci(config config) *songci.Songci {
builder := songci.New()
if 0 != config.Timeout {
builder.Timeout(config.Timeout)
}
if nil != config.Zinan {
builder.Zinan().Scheme(config.Zinan.Scheme)
}

return builder.Build()
}
19 changes: 0 additions & 19 deletions starter.go

This file was deleted.

6 changes: 6 additions & 0 deletions zinan.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package songci

type zinan struct {
// 模式
Scheme string `json:"scheme" yaml:"scheme" xml:"scheme" toml:"scheme"`
}

0 comments on commit 46814de

Please sign in to comment.