Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

使用Go Module #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
81 changes: 81 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
module github.com/TeaWeb/code

go 1.14

require (
github.com/Azure/azure-sdk-for-go v44.2.0+incompatible
github.com/Azure/go-autorest/autorest v0.11.2
github.com/Azure/go-autorest/autorest/adal v0.9.0
github.com/Azure/go-autorest/autorest/azure/auth v0.5.0
github.com/Azure/go-autorest/autorest/to v0.4.0
github.com/Azure/go-autorest/autorest/validation v0.3.0 // indirect
github.com/BurntSushi/toml v0.3.1
github.com/JamesClonk/vultr v2.0.1+incompatible
github.com/Microsoft/go-winio v0.4.14
github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/TeaWeb/agent v0.0.0-20191129072344-6274ce47207a
github.com/TeaWeb/plugin v0.0.0-20190202040243-6fb957e0eb4a
github.com/TeaWeb/uaparser v0.0.0-20190526084055-a1c9449348d8
github.com/akamai/AkamaiOPEN-edgegrid-golang v0.9.18
github.com/aliyun/alibaba-cloud-sdk-go v1.61.370
github.com/aws/aws-sdk-go v1.30.20
github.com/cenkalti/backoff v2.2.1+incompatible
github.com/cloudflare/cloudflare-go v0.13.0
github.com/cpu/goacmedns v0.0.3
github.com/dchest/captcha v0.0.0-20170622155422-6a29415a8364
github.com/dchest/siphash v1.2.1
github.com/decker502/dnspod-go v0.2.0
github.com/dnsimple/dnsimple-go v0.63.0
github.com/exoscale/egoscale v0.28.0
github.com/go-acme/lego v2.7.2+incompatible
github.com/go-ole/go-ole v1.2.4 // indirect
github.com/go-redis/redis v6.15.8+incompatible
github.com/go-sql-driver/mysql v1.5.0
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible
github.com/go-yaml/yaml v2.1.0+incompatible
github.com/gophercloud/gophercloud v0.12.0
github.com/gorilla/websocket v1.4.2
github.com/iij/doapi v0.0.0-20190504054126-0bbf12d6d7df
github.com/iwind/TeaGo v0.0.0-20200731084534-255664a0c121
github.com/iwind/gofcgi v0.0.0-20181229122301-daea2786cb0d
github.com/jlaffaye/ftp v0.0.0-20200730135723-c2ee4fa2503b
github.com/labbsr0x/bindman-dns-webhook v1.0.2
github.com/lib/pq v1.8.0
github.com/linode/linodego v0.20.0
github.com/luckygo666/lego/v3 v3.8.88
github.com/mailru/easyjson v0.7.2
github.com/miekg/dns v1.1.31
github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04
github.com/nrdcg/auroradns v1.0.1
github.com/nrdcg/goinwx v0.7.0
github.com/nrdcg/namesilo v0.2.1 // indirect
github.com/oracle/oci-go-sdk v22.0.0+incompatible
github.com/oschwald/geoip2-golang v1.4.0
github.com/ovh/go-ovh v1.1.0
github.com/pkg/sftp v1.11.0
github.com/pquerna/ffjson v0.0.0-20190930134022-aa0246cd15f7
github.com/rainycape/memcache v0.0.0-20150622160815-1031fa0ce2f2
github.com/robertkrimen/otto v0.0.0-20191219234010-c382bd3c16ff
github.com/sacloud/libsacloud v1.36.1
github.com/shirou/gopsutil v2.20.6+incompatible
github.com/stretchr/testify v1.6.1
github.com/syndtr/goleveldb v1.0.0
github.com/tatsushid/go-fastping v0.0.0-20160109021039-d7bb493dee3e
github.com/technoweenie/multipartstreamer v1.0.1 // indirect
github.com/timewasted/linode v0.0.0-20160829202747-37e84520dcf7
github.com/transip/gotransip v5.8.2+incompatible
github.com/urfave/cli v1.22.4
github.com/vmihailenco/msgpack v4.0.4+incompatible
github.com/vultr/govultr v0.4.2 // indirect
go.mongodb.org/mongo-driver v1.4.0
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
golang.org/x/net v0.0.0-20200707034311-ab3426394381
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20200802091954-4b90ce9b60b3
google.golang.org/api v0.29.0
google.golang.org/appengine v1.6.6 // indirect
gopkg.in/ns1/ns1-go.v2 v2.4.1
gopkg.in/sourcemap.v1 v1.0.5 // indirect
gopkg.in/square/go-jose.v2 v2.5.1
)
831 changes: 831 additions & 0 deletions go.sum

Large diffs are not rendered by default.

19 changes: 9 additions & 10 deletions teacache/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"github.com/go-redis/redis"
"github.com/iwind/TeaGo/logs"
"github.com/iwind/TeaGo/maps"
"golang.org/x/net/context"
"strings"
"time"
)
Expand Down Expand Up @@ -74,12 +73,12 @@ func (this *RedisManager) SetOptions(options map[string]interface{}) {
}

func (this *RedisManager) Write(key string, data []byte) error {
cmd := this.client.Set(context.Background(), "TEA_CACHE_"+this.id+key, string(data), this.Life)
cmd := this.client.Set("TEA_CACHE_"+this.id+key, string(data), this.Life)
return cmd.Err()
}

func (this *RedisManager) Read(key string) (data []byte, err error) {
cmd := this.client.Get(context.Background(), "TEA_CACHE_"+this.id+key)
cmd := this.client.Get("TEA_CACHE_"+this.id+key)
if cmd.Err() != nil {
if cmd.Err() == redis.Nil {
return nil, ErrNotFound
Expand All @@ -92,7 +91,7 @@ func (this *RedisManager) Read(key string) (data []byte, err error) {

// 删除
func (this *RedisManager) Delete(key string) error {
cmd := this.client.Del(context.Background(), "TEA_CACHE_"+this.id+key)
cmd := this.client.Del("TEA_CACHE_"+this.id+key)
return cmd.Err()
}

Expand All @@ -112,7 +111,7 @@ func (this *RedisManager) DeletePrefixes(prefixes []string) (int, error) {
loopCount++

var keys []string
keys, cursor, err = this.client.Scan(context.Background(), cursor, keyPrefix+"*", 10000).Result()
keys, cursor, err = this.client.Scan(cursor, keyPrefix+"*", 10000).Result()
if err != nil {
return count, err
}
Expand All @@ -121,7 +120,7 @@ func (this *RedisManager) DeletePrefixes(prefixes []string) (int, error) {
realKey := key[keyPrefixLength:]
for _, prefix := range prefixes {
if strings.HasPrefix(realKey, prefix) || strings.HasPrefix("http://"+realKey, prefix) || strings.HasPrefix("https://"+realKey, prefix) {
err1 := this.client.Del(context.Background(), key).Err()
err1 := this.client.Del(key).Err()
if err1 != nil {
err = err1
break
Expand Down Expand Up @@ -154,14 +153,14 @@ func (this *RedisManager) Stat() (size int64, countKeys int, err error) {
loopCount++

var keys []string
keys, cursor, err = this.client.Scan(context.Background(), cursor, "TEA_CACHE_"+this.Id()+"*", 10000).Result()
keys, cursor, err = this.client.Scan(cursor, "TEA_CACHE_"+this.Id()+"*", 10000).Result()
if err != nil {
return
}
if len(keys) > 0 {
countKeys += len(keys)
for _, key := range keys {
val, _ := this.client.Get(context.Background(), key).Bytes()
val, _ := this.client.Get(key).Bytes()
size += int64(len(val))
}
}
Expand All @@ -187,13 +186,13 @@ func (this *RedisManager) Clean() error {
loopCount++

var keys []string
keys, cursor, err = this.client.Scan(context.Background(), cursor, "TEA_CACHE_"+this.Id()+"*", 10000).Result()
keys, cursor, err = this.client.Scan(cursor, "TEA_CACHE_"+this.Id()+"*", 10000).Result()
if err != nil {
return err
}
if len(keys) > 0 {
for _, key := range keys {
err1 := this.client.Del(context.Background(), key).Err()
err1 := this.client.Del(key).Err()
if err1 != nil {
err = err1
break
Expand Down
16 changes: 8 additions & 8 deletions teaconfigs/ssl_acme_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import (
"crypto/x509"
"encoding/base64"
"errors"
"github.com/go-acme/lego/acme"
"github.com/go-acme/lego/certcrypto"
"github.com/go-acme/lego/certificate"
"github.com/go-acme/lego/challenge/dns01"
"github.com/go-acme/lego/lego"
"github.com/go-acme/lego/log"
"github.com/go-acme/lego/registration"
"github.com/iwind/TeaGo/utils/time"
timeutil "github.com/iwind/TeaGo/utils/time"
"github.com/luckygo666/lego/v3/acme"
"github.com/luckygo666/lego/v3/certcrypto"
"github.com/luckygo666/lego/v3/certificate"
"github.com/luckygo666/lego/v3/challenge/dns01"
"github.com/luckygo666/lego/v3/lego"
"github.com/luckygo666/lego/v3/log"
"github.com/luckygo666/lego/v3/registration"
"io/ioutil"
golog "log"
"strings"
Expand Down
2 changes: 1 addition & 1 deletion teaconfigs/ssl_acme_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package teaconfigs

import (
"crypto"
"github.com/go-acme/lego/registration"
"github.com/luckygo666/lego/v3/registration"
)

// ACME用户账号定义
Expand Down
3 changes: 1 addition & 2 deletions teatesting/require.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package teatesting

import (
"context"
"github.com/TeaWeb/code/teautils"
"github.com/go-redis/redis"
"github.com/iwind/TeaGo/logs"
Expand Down Expand Up @@ -102,7 +101,7 @@ func RequireRedis() bool {
Addr: "127.0.0.1:6379",
DialTimeout: 5 * time.Second,
})
cmd := client.Ping(context.Background())
cmd := client.Ping()
return cmd.Err() == nil
}

Expand Down
8 changes: 0 additions & 8 deletions vendor/github.com/go-acme/lego/.dockerignore

This file was deleted.

Binary file removed vendor/github.com/go-acme/lego/.gitcookies.enc
Binary file not shown.
6 changes: 0 additions & 6 deletions vendor/github.com/go-acme/lego/.gitignore

This file was deleted.

83 changes: 0 additions & 83 deletions vendor/github.com/go-acme/lego/.golangci.toml

This file was deleted.

43 changes: 0 additions & 43 deletions vendor/github.com/go-acme/lego/.goreleaser.yml

This file was deleted.

Loading