mirror of
https://github.com/veops/oneterm.git
synced 2025-09-26 19:31:14 +08:00
feat: add ssh server
This commit is contained in:
1
backend
1
backend
Submodule backend deleted from 96468b7c24
13
backend/.gitignore
vendored
Normal file
13
backend/.gitignore
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
.idea
|
||||
*.log
|
||||
*.cast
|
||||
vendor/
|
||||
volume
|
||||
|
||||
cmd/ssh/ssh
|
||||
cmd/ssh/config.yaml
|
||||
cmd/ssh/app.log
|
||||
|
||||
cmd/api/api
|
||||
cmd/api/config.yaml
|
||||
|
17
backend/cmd/api/api.go
Normal file
17
backend/cmd/api/api.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/veops/oneterm/cmd/api/app"
|
||||
)
|
||||
|
||||
func main() {
|
||||
command := app.NewServerCommand()
|
||||
|
||||
if err := command.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
135
backend/cmd/api/app/api.go
Normal file
135
backend/cmd/api/app/api.go
Normal file
@@ -0,0 +1,135 @@
|
||||
// Package app
|
||||
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/oklog/run"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/veops/oneterm/pkg/conf"
|
||||
"github.com/veops/oneterm/pkg/logger"
|
||||
"github.com/veops/oneterm/pkg/server/cmdb"
|
||||
"github.com/veops/oneterm/pkg/server/controller"
|
||||
"github.com/veops/oneterm/pkg/server/router"
|
||||
"github.com/veops/oneterm/pkg/server/storage/cache/local"
|
||||
"github.com/veops/oneterm/pkg/server/storage/cache/redis"
|
||||
"github.com/veops/oneterm/pkg/server/storage/db/mysql"
|
||||
)
|
||||
|
||||
const (
|
||||
componentServer = "./server"
|
||||
)
|
||||
|
||||
var (
|
||||
configFilePath string
|
||||
)
|
||||
|
||||
var cmdRun = &cobra.Command{
|
||||
Use: "run",
|
||||
Example: fmt.Sprintf("%s run -c apps", componentServer),
|
||||
Short: "run",
|
||||
Long: `a run test`,
|
||||
Args: cobra.MinimumNArgs(0),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
Run()
|
||||
os.Exit(0)
|
||||
},
|
||||
}
|
||||
|
||||
func NewServerCommand() *cobra.Command {
|
||||
command := &cobra.Command{
|
||||
Use: componentServer,
|
||||
}
|
||||
|
||||
cmdRun.PersistentFlags().StringVarP(&configFilePath, "config", "c", "./", "config path")
|
||||
command.AddCommand(cmdRun)
|
||||
return command
|
||||
}
|
||||
|
||||
func Run() {
|
||||
parseConfig(configFilePath)
|
||||
gr := run.Group{}
|
||||
ctx, logCancel := context.WithCancel(context.Background())
|
||||
|
||||
if err := logger.Init(ctx, conf.Cfg.Log); err != nil {
|
||||
fmt.Println("err init failed", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err := mysql.Init(conf.Cfg.Mysql); err != nil {
|
||||
logger.L.Error("mysql init failed: " + err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err := redis.Init(conf.Cfg.Redis); err != nil {
|
||||
logger.L.Error("redis init failed: " + err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err := local.Init(); err != nil {
|
||||
logger.L.Error("local init failed: " + err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err := controller.Init(); err != nil {
|
||||
logger.L.Error("local init failed: " + err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
{
|
||||
// Termination handler.
|
||||
term := make(chan os.Signal, 1)
|
||||
signal.Notify(term, os.Interrupt, syscall.SIGTERM)
|
||||
gr.Add(
|
||||
func() error {
|
||||
<-term
|
||||
logger.L.Warn("Received SIGTERM, exiting gracefully...")
|
||||
return nil
|
||||
},
|
||||
func(err error) {},
|
||||
)
|
||||
}
|
||||
{
|
||||
cancel := make(chan struct{})
|
||||
gr.Add(func() error {
|
||||
gin.SetMode(conf.Cfg.Mode)
|
||||
srv := router.Server(conf.Cfg)
|
||||
router.GracefulExit(srv, cancel)
|
||||
return nil
|
||||
}, func(err error) {
|
||||
close(cancel)
|
||||
})
|
||||
gr.Add(cmdb.Run, cmdb.Stop)
|
||||
}
|
||||
|
||||
if err := gr.Run(); err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
|
||||
logger.L.Info("exiting")
|
||||
logCancel()
|
||||
}
|
||||
|
||||
func parseConfig(filePath string) {
|
||||
viper.SetConfigName("config")
|
||||
viper.SetConfigType("yaml")
|
||||
viper.AddConfigPath(filePath)
|
||||
viper.AddConfigPath(".")
|
||||
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil { // Handle errors reading the config file
|
||||
panic(fmt.Errorf("fatal error config file: %s", err))
|
||||
}
|
||||
|
||||
if err = viper.Unmarshal(&conf.Cfg); err != nil {
|
||||
panic(fmt.Sprintf("parse config from config.yaml failed:%s", err))
|
||||
}
|
||||
}
|
58
backend/cmd/api/config.example.yaml
Normal file
58
backend/cmd/api/config.example.yaml
Normal file
@@ -0,0 +1,58 @@
|
||||
mode: debug
|
||||
|
||||
http:
|
||||
ip: 0.0.0.0
|
||||
port: 8080
|
||||
|
||||
mysql:
|
||||
ip: mysql
|
||||
port: 3306
|
||||
user: root
|
||||
password: root
|
||||
|
||||
redis:
|
||||
addr: myredis:6379
|
||||
password: root
|
||||
|
||||
log:
|
||||
level: debug
|
||||
path: app.log
|
||||
format: json
|
||||
maxSize: 1
|
||||
# consoleEnable Whether to enable outputting logs to the console as the sametime
|
||||
consoleEnable: true
|
||||
|
||||
auth:
|
||||
acl:
|
||||
appId: acl app id
|
||||
secretKey: acl app secret key
|
||||
url: http://host/api/v1
|
||||
resourceNames:
|
||||
- key: account
|
||||
value: account
|
||||
- key: asset
|
||||
value: asset
|
||||
- key: command
|
||||
value: command
|
||||
- key: gateway
|
||||
value: gateway
|
||||
- key: authorization
|
||||
value: authorization
|
||||
|
||||
cmdb:
|
||||
url: http://host/api/v0.1
|
||||
|
||||
secretKey: acl secret key
|
||||
|
||||
worker:
|
||||
uid: 123
|
||||
rid: 456
|
||||
key: acl key
|
||||
secret: acl secret
|
||||
|
||||
sshServer:
|
||||
ip: 127.0.0.1
|
||||
port: 2222
|
||||
account: test
|
||||
password: 135790
|
||||
xtoken: 123456
|
147
backend/cmd/ssh/app/ssh.go
Normal file
147
backend/cmd/ssh/app/ssh.go
Normal file
@@ -0,0 +1,147 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
"github.com/oklog/run"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"github.com/veops/oneterm/pkg/conf"
|
||||
"github.com/veops/oneterm/pkg/logger"
|
||||
sshproto "github.com/veops/oneterm/pkg/proto/ssh"
|
||||
cfg "github.com/veops/oneterm/pkg/proto/ssh/config"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/handler"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/tasks"
|
||||
)
|
||||
|
||||
const (
|
||||
componentServer = "./server"
|
||||
)
|
||||
|
||||
var (
|
||||
configFilePath string
|
||||
)
|
||||
|
||||
var cmdRun = &cobra.Command{
|
||||
Use: "ssh",
|
||||
Example: fmt.Sprintf("%s ssh -c apps", componentServer),
|
||||
Short: "run",
|
||||
Long: `a run test`,
|
||||
Args: cobra.MinimumNArgs(0),
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
Run()
|
||||
os.Exit(0)
|
||||
},
|
||||
}
|
||||
|
||||
func NewServerCommand() *cobra.Command {
|
||||
command := &cobra.Command{
|
||||
Use: componentServer,
|
||||
}
|
||||
|
||||
cmdRun.PersistentFlags().StringVarP(&configFilePath, "config", "c", "./", "config path")
|
||||
command.AddCommand(cmdRun)
|
||||
return command
|
||||
}
|
||||
|
||||
func Run() {
|
||||
parseConfig(configFilePath)
|
||||
|
||||
gr := run.Group{}
|
||||
ctx, logCancel := context.WithCancel(context.Background())
|
||||
|
||||
if err := logger.Init(ctx, conf.Cfg.Log); err != nil {
|
||||
fmt.Println("err init failed", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
handler.I18nInit(conf.Cfg.I18nDir)
|
||||
|
||||
{
|
||||
// Termination handler.
|
||||
term := make(chan os.Signal, 1)
|
||||
signal.Notify(term, os.Interrupt, syscall.SIGTERM)
|
||||
gr.Add(
|
||||
func() error {
|
||||
<-term
|
||||
logger.L.Warn("Received SIGTERM, exiting gracefully...")
|
||||
return nil
|
||||
},
|
||||
func(err error) {},
|
||||
)
|
||||
}
|
||||
{
|
||||
cancel := make(chan struct{})
|
||||
gr.Add(func() error {
|
||||
_ = sshproto.Run(fmt.Sprintf("%s:%d", cfg.SSHConfig.Ip, cfg.SSHConfig.Port),
|
||||
cfg.SSHConfig.Api,
|
||||
cfg.SSHConfig.Token,
|
||||
cfg.SSHConfig.PrivateKeyPath,
|
||||
conf.Cfg.SecretKey)
|
||||
<-cancel
|
||||
return nil
|
||||
}, func(err error) {
|
||||
close(cancel)
|
||||
})
|
||||
}
|
||||
{
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
gr.Add(func() error {
|
||||
tasks.LoopCheck(ctx, cfg.SSHConfig.Api, cfg.SSHConfig.Token)
|
||||
return nil
|
||||
}, func(err error) {
|
||||
cancel()
|
||||
})
|
||||
}
|
||||
|
||||
if err := gr.Run(); err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
|
||||
logger.L.Info("exiting")
|
||||
logCancel()
|
||||
}
|
||||
|
||||
func parseConfig(filePath string) {
|
||||
viper.SetConfigName("config")
|
||||
viper.SetConfigType("yaml")
|
||||
viper.AddConfigPath(filePath)
|
||||
viper.AddConfigPath(".")
|
||||
|
||||
err := viper.ReadInConfig()
|
||||
if err != nil { // Handle errors reading the config file
|
||||
panic(fmt.Errorf("fatal error config file: %s", err))
|
||||
}
|
||||
|
||||
if err = viper.Unmarshal(&conf.Cfg); err != nil {
|
||||
panic(fmt.Sprintf("parse config from config.yaml failed:%s", err))
|
||||
}
|
||||
|
||||
if sc, ok := conf.Cfg.Protocols["ssh"]; ok {
|
||||
er := mapstructure.Decode(sc, &cfg.SSHConfig)
|
||||
if er != nil {
|
||||
panic(er)
|
||||
}
|
||||
switch v := sc.(type) {
|
||||
case map[string]interface{}:
|
||||
if v1, ok := v["ip"]; ok {
|
||||
cfg.SSHConfig.Ip = v1.(string)
|
||||
} else {
|
||||
cfg.SSHConfig.Ip = "127.0.0.1"
|
||||
}
|
||||
if v1, ok := v["port"]; ok {
|
||||
cfg.SSHConfig.Port = v1.(int)
|
||||
} else {
|
||||
cfg.SSHConfig.Port = 45622
|
||||
}
|
||||
//cfg.SSHConfig.Api = fmt.Sprintf("%v", v["api"])
|
||||
//cfg.SSHConfig.Token = fmt.Sprintf("%v", v["token"])
|
||||
//cfg.SSHConfig.WebUser = v["webUser"]
|
||||
}
|
||||
}
|
||||
}
|
12
backend/cmd/ssh/config.example.yaml
Normal file
12
backend/cmd/ssh/config.example.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
protocols:
|
||||
ssh:
|
||||
api: oneterm-api:8080
|
||||
ip: '0.0.0.0'
|
||||
port: 2222
|
||||
webUser: "test"
|
||||
webToken: "135790"
|
||||
privateKeyPath: /root/.ssh/id_ed25519
|
||||
|
||||
|
||||
i18nDir: ./translate
|
17
backend/cmd/ssh/ssh.go
Normal file
17
backend/cmd/ssh/ssh.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/veops/oneterm/cmd/ssh/app"
|
||||
)
|
||||
|
||||
func main() {
|
||||
command := app.NewServerCommand()
|
||||
|
||||
if err := command.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
16
backend/dockerfile-api
Normal file
16
backend/dockerfile-api
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM golang:1.21.3-alpine3.17
|
||||
WORKDIR /oneterm
|
||||
COPY . .
|
||||
RUN go env -w GOPROXY=https://goproxy.cn,direct \
|
||||
&& go build --ldflags "-s -w" -o ./build/api ./cmd/api/api.go
|
||||
|
||||
FROM alpine:latest
|
||||
RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
||||
RUN apk add tzdata
|
||||
ENV TZ=Asia/Shanghai
|
||||
WORKDIR /oneterm
|
||||
COPY --from=0 /oneterm/cmd/api/config.yaml .
|
||||
COPY --from=0 /oneterm/pkg/i18n/translate ./translate
|
||||
COPY --from=0 /oneterm/build/api .
|
||||
CMD [ "./api","run","-c","./config.yaml"]
|
||||
|
18
backend/dockerfile-ssh
Normal file
18
backend/dockerfile-ssh
Normal file
@@ -0,0 +1,18 @@
|
||||
FROM golang:1.21.3-alpine3.17
|
||||
WORKDIR /oneterm
|
||||
COPY . .
|
||||
RUN go env -w GOPROXY=https://goproxy.cn,direct \
|
||||
&& go build --ldflags "-s -w" -o ./build/ssh ./cmd/ssh/ssh.go
|
||||
|
||||
FROM alpine:latest
|
||||
RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
|
||||
RUN apk add tzdata
|
||||
RUN mkdir -p '/root/.ssh'
|
||||
RUN touch '/root/.ssh/id_ed25519'
|
||||
ENV TZ=Asia/Shanghai
|
||||
WORKDIR /oneterm
|
||||
COPY --from=0 /oneterm/cmd/ssh/config.yaml .
|
||||
COPY --from=0 /oneterm/pkg/i18n/translate ./translate
|
||||
COPY --from=0 /oneterm/build/ssh .
|
||||
CMD [ "./ssh","ssh","-c","./config.yaml"]
|
||||
|
2704
backend/docs/docs.go
Normal file
2704
backend/docs/docs.go
Normal file
File diff suppressed because it is too large
Load Diff
BIN
backend/docs/images/wechat.jpg
Normal file
BIN
backend/docs/images/wechat.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 213 KiB |
2673
backend/docs/swagger.json
Normal file
2673
backend/docs/swagger.json
Normal file
File diff suppressed because it is too large
Load Diff
1626
backend/docs/swagger.yaml
Normal file
1626
backend/docs/swagger.yaml
Normal file
File diff suppressed because it is too large
Load Diff
126
backend/go.mod
Normal file
126
backend/go.mod
Normal file
@@ -0,0 +1,126 @@
|
||||
module github.com/veops/oneterm
|
||||
|
||||
go 1.21.3
|
||||
|
||||
require (
|
||||
github.com/c-bata/go-prompt v0.2.6
|
||||
github.com/charmbracelet/bubbles v0.17.1
|
||||
github.com/charmbracelet/bubbletea v0.25.0
|
||||
github.com/charmbracelet/lipgloss v0.9.1
|
||||
github.com/chzyer/readline v1.5.1
|
||||
github.com/gin-contrib/sessions v0.0.5
|
||||
github.com/gliderlabs/ssh v0.3.5
|
||||
github.com/google/uuid v1.5.0
|
||||
github.com/mattn/go-runewidth v0.0.15
|
||||
github.com/nicksnyder/go-i18n/v2 v2.3.0
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||
github.com/pires/go-proxyproto v0.7.0
|
||||
github.com/prometheus/client_golang v1.16.0
|
||||
github.com/spf13/cobra v1.7.0
|
||||
github.com/spf13/viper v1.17.0
|
||||
github.com/swaggo/files v1.0.1
|
||||
github.com/swaggo/gin-swagger v1.6.0
|
||||
github.com/swaggo/swag v1.16.2
|
||||
github.com/veops/go-ansiterm v0.0.2
|
||||
go.uber.org/zap v1.21.0
|
||||
golang.org/x/crypto v0.15.0
|
||||
golang.org/x/sync v0.5.0
|
||||
golang.org/x/text v0.14.0
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1
|
||||
gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/KyleBanks/depth v1.2.1 // indirect
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bytedance/sonic v1.10.2 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
|
||||
github.com/chenzhuoyu/iasm v0.9.1 // indirect
|
||||
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
|
||||
github.com/fsnotify/fsnotify v1.6.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.20.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||
github.com/go-openapi/spec v0.20.9 // indirect
|
||||
github.com/go-openapi/swag v0.22.4 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.16.0 // indirect
|
||||
github.com/go-sql-driver/mysql v1.7.0 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/golang/protobuf v1.5.3 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/gorilla/context v1.1.1 // indirect
|
||||
github.com/gorilla/securecookie v1.1.1 // indirect
|
||||
github.com/gorilla/sessions v1.2.1 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/jinzhu/inflection v1.0.0 // indirect
|
||||
github.com/jinzhu/now v1.1.5 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.6 // indirect
|
||||
github.com/leodido/go-urn v1.2.4 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-localereader v0.0.1 // indirect
|
||||
github.com/mattn/go-tty v0.0.3 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b // indirect
|
||||
github.com/muesli/cancelreader v0.2.2 // indirect
|
||||
github.com/muesli/reflow v0.3.0 // indirect
|
||||
github.com/muesli/termenv v0.15.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
||||
github.com/pkg/term v1.2.0-beta.2 // indirect
|
||||
github.com/prometheus/client_model v0.4.0 // indirect
|
||||
github.com/prometheus/common v0.44.0 // indirect
|
||||
github.com/prometheus/procfs v0.11.0 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.3.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spf13/afero v1.10.0 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||
go.uber.org/atomic v1.11.0 // indirect
|
||||
go.uber.org/goleak v1.2.1 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
golang.org/x/arch v0.6.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
|
||||
golang.org/x/net v0.18.0 // indirect
|
||||
golang.org/x/term v0.16.0 // indirect
|
||||
golang.org/x/tools v0.15.0 // indirect
|
||||
google.golang.org/protobuf v1.31.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gorm.io/driver/sqlite v1.4.3 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v1.3.2
|
||||
github.com/allegro/bigcache/v3 v3.1.0
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/gin-gonic/gin v1.9.1
|
||||
github.com/go-resty/resty/v2 v2.10.0
|
||||
github.com/gorilla/websocket v1.5.1
|
||||
github.com/mitchellh/mapstructure v1.5.0
|
||||
github.com/oklog/run v1.1.0
|
||||
github.com/redis/go-redis/v9 v9.2.1
|
||||
github.com/samber/lo v1.38.1
|
||||
github.com/spf13/cast v1.5.1
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
golang.org/x/sys v0.16.0 // indirect
|
||||
gorm.io/driver/mysql v1.5.2
|
||||
gorm.io/plugin/soft_delete v1.2.1
|
||||
)
|
816
backend/go.sum
Normal file
816
backend/go.sum
Normal file
@@ -0,0 +1,816 @@
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU=
|
||||
cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
||||
cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY=
|
||||
cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc=
|
||||
cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0=
|
||||
cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To=
|
||||
cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4=
|
||||
cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M=
|
||||
cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc=
|
||||
cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk=
|
||||
cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs=
|
||||
cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc=
|
||||
cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY=
|
||||
cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI=
|
||||
cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk=
|
||||
cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY=
|
||||
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
|
||||
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
|
||||
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
|
||||
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
|
||||
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
|
||||
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
|
||||
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
|
||||
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
|
||||
cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk=
|
||||
cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
|
||||
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
|
||||
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
|
||||
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
|
||||
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
||||
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
||||
github.com/allegro/bigcache/v3 v3.1.0 h1:H2Vp8VOvxcrB91o86fUSVJFqeuz8kpyyB02eH3bSzwk=
|
||||
github.com/allegro/bigcache/v3 v3.1.0/go.mod h1:aPyh7jEvrog9zAwx5N7+JUQX5dZTSGpxF1LAR4dr35I=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
|
||||
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
|
||||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
|
||||
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
|
||||
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
|
||||
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
|
||||
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
|
||||
github.com/bytedance/sonic v1.10.0-rc/go.mod h1:ElCzW+ufi8qKqNW0FY314xriJhyJhuoJ3gFZdAHF7NM=
|
||||
github.com/bytedance/sonic v1.10.2 h1:GQebETVBxYB7JGWJtLBi07OVzWwt+8dWA00gEVW2ZFE=
|
||||
github.com/bytedance/sonic v1.10.2/go.mod h1:iZcSUejdk5aukTND/Eu/ivjQuEL0Cu9/rf50Hi0u/g4=
|
||||
github.com/c-bata/go-prompt v0.2.6 h1:POP+nrHE+DfLYx370bedwNhsqmpCUynWPxuHi0C5vZI=
|
||||
github.com/c-bata/go-prompt v0.2.6/go.mod h1:/LMAke8wD2FsNu9EXNdHxNLbd9MedkPnCdfpU9wwHfY=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/charmbracelet/bubbles v0.17.1 h1:0SIyjOnkrsfDo88YvPgAWvZMwXe26TP6drRvmkjyUu4=
|
||||
github.com/charmbracelet/bubbles v0.17.1/go.mod h1:9HxZWlkCqz2PRwsCbYl7a3KXvGzFaDHpYbSYMJ+nE3o=
|
||||
github.com/charmbracelet/bubbletea v0.25.0 h1:bAfwk7jRz7FKFl9RzlIULPkStffg5k6pNt5dywy4TcM=
|
||||
github.com/charmbracelet/bubbletea v0.25.0/go.mod h1:EN3QDR1T5ZdWmdfDzYcqOCAps45+QIJbLOBxmVNWNNg=
|
||||
github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1p/u1KWg=
|
||||
github.com/charmbracelet/lipgloss v0.9.1/go.mod h1:1mPmG4cxScwUQALAAnacHaigiiHB9Pmr+v1VEawJl6I=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583jCggY9gE99b6G5LEC39OIiVsWj+R97kbl5odCEk=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d h1:77cEq6EriyTZ0g/qfRdp61a3Uu/AWrgIq2s0ClJV1g0=
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d/go.mod h1:8EPpVsBuRksnlj1mLy4AWzRNQYxauNi62uWcE3to6eA=
|
||||
github.com/chenzhuoyu/iasm v0.9.0/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
|
||||
github.com/chenzhuoyu/iasm v0.9.1 h1:tUHQJXo3NhBqw6s33wkGn9SP3bvrWLdlVIJ3hQBL7P0=
|
||||
github.com/chenzhuoyu/iasm v0.9.1/go.mod h1:Xjy2NpN3h7aUqeqM+woSuuvxmIe6+DDsiNLIrkAmYog=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM=
|
||||
github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI=
|
||||
github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04=
|
||||
github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY=
|
||||
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
|
||||
github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
||||
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
|
||||
github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
|
||||
github.com/gin-contrib/sessions v0.0.5 h1:CATtfHmLMQrMNpJRgzjWXD7worTh7g7ritsQfmF+0jE=
|
||||
github.com/gin-contrib/sessions v0.0.5/go.mod h1:vYAuaUPqie3WUSsft6HUlCjlwwoJQs97miaG2+7neKY=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
|
||||
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
|
||||
github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY=
|
||||
github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
|
||||
github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ=
|
||||
github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA=
|
||||
github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo=
|
||||
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
|
||||
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
|
||||
github.com/go-openapi/spec v0.20.9 h1:xnlYNQAwKd2VQRRfwTEI0DcK+2cbuvI/0c7jx3gA8/8=
|
||||
github.com/go-openapi/spec v0.20.9/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA=
|
||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
||||
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
|
||||
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.16.0 h1:x+plE831WK4vaKHO/jpgUGsvLKIqRRkz6M78GuJAfGE=
|
||||
github.com/go-playground/validator/v10 v10.16.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
|
||||
github.com/go-resty/resty/v2 v2.10.0 h1:Qla4W/+TMmv0fOeeRqzEpXPLfTUnR5HZ1+lGs+CkiCo=
|
||||
github.com/go-resty/resty/v2 v2.10.0/go.mod h1:iiP/OpA0CkcL3IGt1O0+/SIItFUbkkyw5BGXiVdTu+A=
|
||||
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
|
||||
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y=
|
||||
github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
|
||||
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
|
||||
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
|
||||
github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
|
||||
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g=
|
||||
github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8=
|
||||
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
|
||||
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
|
||||
github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI=
|
||||
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
|
||||
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
|
||||
github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||
github.com/jinzhu/now v1.1.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc=
|
||||
github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
|
||||
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
|
||||
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
|
||||
github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
||||
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
|
||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-sqlite3 v1.14.3/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
|
||||
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U=
|
||||
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
||||
github.com/mattn/go-tty v0.0.3 h1:5OfyWorkyO7xP52Mq7tB36ajHDG5OHrmBGIS/DtakQI=
|
||||
github.com/mattn/go-tty v0.0.3/go.mod h1:ihxohKRERHTVzN+aSVRwACLCeqIoZAWpoICkkvrWyR0=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b h1:1XF24mVaiu7u+CFywTdcDo2ie1pzzhwjt6RHqzpMU34=
|
||||
github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho=
|
||||
github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
|
||||
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
|
||||
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
|
||||
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
|
||||
github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=
|
||||
github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
|
||||
github.com/nicksnyder/go-i18n/v2 v2.3.0 h1:2NPsCsNFCVd7i+Su0xYsBrIhS3bE2XMv5gNTft2O+PQ=
|
||||
github.com/nicksnyder/go-i18n/v2 v2.3.0/go.mod h1:nxYSZE9M0bf3Y70gPQjN9ha7XNHX7gMc814+6wVyEI4=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
|
||||
github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU=
|
||||
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
|
||||
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
|
||||
github.com/pires/go-proxyproto v0.7.0 h1:IukmRewDQFWC7kfnb66CSomk2q/seBuilHBYFwyq0Hs=
|
||||
github.com/pires/go-proxyproto v0.7.0/go.mod h1:Vz/1JPY/OACxWGQNIRY2BeyDmpoaWmEP40O9LbuiFR4=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg=
|
||||
github.com/pkg/term v1.2.0-beta.2 h1:L3y/h2jkuBVFdWiJvNfYfKmzcCnILw7mJWm2JQuMppw=
|
||||
github.com/pkg/term v1.2.0-beta.2/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8=
|
||||
github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY=
|
||||
github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
|
||||
github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY=
|
||||
github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
|
||||
github.com/prometheus/procfs v0.11.0 h1:5EAgkfkMl659uZPbe9AS2N68a7Cc1TJbPEuGzFuRbyk=
|
||||
github.com/prometheus/procfs v0.11.0/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM=
|
||||
github.com/redis/go-redis/v9 v9.2.1 h1:WlYJg71ODF0dVspZZCpYmoF1+U1Jjk9Rwd7pq6QmlCg=
|
||||
github.com/redis/go-redis/v9 v9.2.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M=
|
||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
|
||||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sagikazarmark/locafero v0.3.0 h1:zT7VEGWC2DTflmccN/5T1etyKvxSxpHsjb9cJvm4SvQ=
|
||||
github.com/sagikazarmark/locafero v0.3.0/go.mod h1:w+v7UsPNFwzF1cHuOajOOzoq4U7v/ig1mpRjqV+Bu1U=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
|
||||
github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM=
|
||||
github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
|
||||
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
||||
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
||||
github.com/spf13/afero v1.10.0 h1:EaGW2JJh15aKOejeuJ+wpFSHnbd7GE6Wvp3TsNhb6LY=
|
||||
github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
|
||||
github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA=
|
||||
github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48=
|
||||
github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
|
||||
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI=
|
||||
github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
|
||||
github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
|
||||
github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M=
|
||||
github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo=
|
||||
github.com/swaggo/swag v1.16.2 h1:28Pp+8DkQoV+HLzLx8RGJZXNGKbFqnuvSbAAtoxiY04=
|
||||
github.com/swaggo/swag v1.16.2/go.mod h1:6YzXnDcpr0767iOejs318CwYkCQqyGer6BizOg03f+E=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
|
||||
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/veops/go-ansiterm v0.0.2 h1:NFtrP6NrrcNGcFXFxlpA+jJmbPKlbWSEf61B9jxCj/s=
|
||||
github.com/veops/go-ansiterm v0.0.2/go.mod h1:ydBaqvRRi5lOTT0dMyYcJjQ1rfJSai/7uNveoT/uRLU=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
|
||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
|
||||
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
|
||||
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
|
||||
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
|
||||
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
|
||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
|
||||
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.21.0 h1:WefMeulhovoZ2sYXz7st6K0sLj7bBhpiFaud4r4zST8=
|
||||
go.uber.org/zap v1.21.0/go.mod h1:wjWOCqI0f2ZZrJF/UufIOkiC8ii6tm1iqIsLo76RfJw=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.6.0 h1:S0JTfE48HbRj80+4tbvZDYsJ3tGv6BUU3XxyZ7CirAc=
|
||||
golang.org/x/arch v0.6.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.0.0-20220826181053-bd7e27e6170d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
|
||||
golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA=
|
||||
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek=
|
||||
golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY=
|
||||
golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
|
||||
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
|
||||
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
|
||||
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs=
|
||||
golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
||||
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
|
||||
golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
|
||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
||||
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
|
||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
|
||||
golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
|
||||
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
|
||||
golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
|
||||
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200918174421-af09f7315aff/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
|
||||
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
||||
golang.org/x/term v0.16.0 h1:m+B6fahuftsE9qjo0VWp2FW0mB3MTJvR0BaMQrq0pmE=
|
||||
golang.org/x/term v0.16.0/go.mod h1:yn7UURbUtPyrVJPGPq404EukNFxcm/foM+bV/bfcDsY=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
|
||||
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
||||
golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||
golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw=
|
||||
golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
|
||||
golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE=
|
||||
golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
|
||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8=
|
||||
golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||
google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg=
|
||||
google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI=
|
||||
google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE=
|
||||
google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE=
|
||||
google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM=
|
||||
google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc=
|
||||
google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg=
|
||||
google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE=
|
||||
google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
||||
google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8=
|
||||
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc=
|
||||
google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA=
|
||||
google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
|
||||
google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
||||
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
|
||||
google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk=
|
||||
google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8=
|
||||
google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
|
||||
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gorm.io/driver/mysql v1.5.2 h1:QC2HRskSE75wBuOxe0+iCkyJZ+RqpudsQtqkp+IMuXs=
|
||||
gorm.io/driver/mysql v1.5.2/go.mod h1:pQLhh1Ut/WUAySdTHwBpBv6+JKcj+ua4ZFx1QQTBzb8=
|
||||
gorm.io/driver/sqlite v1.1.3/go.mod h1:AKDgRWk8lcSQSw+9kxCJnX/yySj8G3rdwYlU57cB45c=
|
||||
gorm.io/driver/sqlite v1.4.3 h1:HBBcZSDnWi5BW3B3rwvVTc510KGkBkexlOg0QrmLUuU=
|
||||
gorm.io/driver/sqlite v1.4.3/go.mod h1:0Aq3iPO+v9ZKbcdiz8gLWRw5VOPcBOPUQJFLq5e2ecI=
|
||||
gorm.io/gorm v1.20.1/go.mod h1:0HFTzE/SqkGTzK6TlDPPQbAYCluiVvhzoA1+aVyzenw=
|
||||
gorm.io/gorm v1.23.0/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
|
||||
gorm.io/gorm v1.24.0/go.mod h1:DVrVomtaYTbqs7gB/x2uVvqnXzv0nqjB396B8cG4dBA=
|
||||
gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55 h1:sC1Xj4TYrLqg1n3AN10w871An7wJM0gzgcm8jkIkECQ=
|
||||
gorm.io/gorm v1.25.2-0.20230530020048-26663ab9bf55/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
|
||||
gorm.io/plugin/soft_delete v1.2.1 h1:qx9D/c4Xu6w5KT8LviX8DgLcB9hkKl6JC9f44Tj7cGU=
|
||||
gorm.io/plugin/soft_delete v1.2.1/go.mod h1:Zv7vQctOJTGOsJ/bWgrN1n3od0GBAZgnLjEx+cApLGk=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
|
||||
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
|
157
backend/pkg/conf/conf.go
Normal file
157
backend/pkg/conf/conf.go
Normal file
@@ -0,0 +1,157 @@
|
||||
package conf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"golang.org/x/text/language"
|
||||
)
|
||||
|
||||
var (
|
||||
Bundle = i18n.NewBundle(language.English)
|
||||
)
|
||||
|
||||
func init() {
|
||||
Bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal)
|
||||
_, err := Bundle.LoadMessageFile("./translate/active.en.toml")
|
||||
if err != nil {
|
||||
fmt.Println("load i18n message failed", err)
|
||||
}
|
||||
_, err = Bundle.LoadMessageFile("./translate/active.zh.toml")
|
||||
if err != nil {
|
||||
fmt.Println("load i18n message failed", err)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
RESOURCE_ACCOUNT = "account"
|
||||
RESOURCE_ASSET = "asset"
|
||||
RESOURCE_COMMAND = "command"
|
||||
RESOURCE_GATEWAY = "gateway"
|
||||
RESOURCE_AUTHORIZATION = "authorization"
|
||||
)
|
||||
|
||||
var (
|
||||
Cfg = &ConfigYaml{
|
||||
Mode: "debug",
|
||||
Http: &HttpConfig{
|
||||
Host: "0.0.0.0",
|
||||
Port: 80,
|
||||
},
|
||||
Log: &LogConfig{
|
||||
Level: "info",
|
||||
MaxSize: 100, // megabytes
|
||||
MaxBackups: 5,
|
||||
MaxAge: 15, // 15 days
|
||||
Compress: true,
|
||||
Path: "app.log",
|
||||
ConsoleEnable: true,
|
||||
},
|
||||
Auth: &Auth{
|
||||
Custom: map[string]string{},
|
||||
},
|
||||
Cmdb: &Cmdb{},
|
||||
Worker: &Worker{},
|
||||
Protocols: map[string]any{},
|
||||
}
|
||||
)
|
||||
|
||||
type HttpConfig struct {
|
||||
Host string `yaml:"host"`
|
||||
Port int `yaml:"port"`
|
||||
}
|
||||
|
||||
type RedisConfig struct {
|
||||
Addr string `yaml:"addr"`
|
||||
Db int `yaml:"db"`
|
||||
Password string `yaml:"password"`
|
||||
MaxIdle int `yaml:"maxIdle"`
|
||||
PoolSize int `yaml:"poolSize"`
|
||||
}
|
||||
|
||||
type MysqlConfig struct {
|
||||
Ip string `yaml:"ip"`
|
||||
Port string `yaml:"port"`
|
||||
User string `yaml:"user"`
|
||||
Password string `yaml:"password"`
|
||||
}
|
||||
|
||||
type KV struct {
|
||||
Key string
|
||||
Value string
|
||||
}
|
||||
|
||||
type AclConfig struct {
|
||||
Url string `yaml:"url"`
|
||||
AppId string `yaml:"appId"`
|
||||
SecretKey string `yaml:"secretKey"`
|
||||
ResourceNames []*KV `yaml:"resourceNames"`
|
||||
}
|
||||
|
||||
type LogConfig struct {
|
||||
Level string `yaml:"level"`
|
||||
Path string `yaml:"path"`
|
||||
// MaxSize max size of single file, unit is MB
|
||||
MaxSize int `yaml:"maxSize"`
|
||||
// MaxBackups max number of backup files
|
||||
MaxBackups int `yaml:"maxBackups"`
|
||||
// MaxAge max days of backup files, unit is day
|
||||
MaxAge int `yaml:"maxAge"`
|
||||
// Compress whether compress backup file
|
||||
Compress bool `yaml:"compress"`
|
||||
// Format
|
||||
Format string `yaml:"format"`
|
||||
// Console output
|
||||
ConsoleEnable bool `yaml:"consoleEnable"`
|
||||
}
|
||||
|
||||
type Auth struct {
|
||||
Acl *AclConfig `yaml:"acl"`
|
||||
Custom map[string]string `yaml:"custom"`
|
||||
}
|
||||
|
||||
type Cmdb struct {
|
||||
Url string `yaml:"url"`
|
||||
}
|
||||
|
||||
type Worker struct {
|
||||
Uid int `yaml:"uid"`
|
||||
Rid int `yaml:"rid"`
|
||||
Key string `yaml:"key"`
|
||||
Secret string `yaml:"secret"`
|
||||
}
|
||||
|
||||
type SshServer struct {
|
||||
Ip string `yaml:"ip"`
|
||||
Port int `yaml:"port"`
|
||||
Account string `yaml:"account"`
|
||||
Password string `yaml:"account"`
|
||||
Xtoken string `yaml:"xtoken"`
|
||||
}
|
||||
|
||||
type ConfigYaml struct {
|
||||
Mode string `yaml:"mode"`
|
||||
Http *HttpConfig `yaml:"http"`
|
||||
Log *LogConfig `yaml:"log"`
|
||||
Redis *RedisConfig `yaml:"redis"`
|
||||
Mysql *MysqlConfig `yaml:"mysql"`
|
||||
Auth *Auth `yaml:"auth"`
|
||||
SecretKey string `yaml:"secretKey"`
|
||||
Cmdb *Cmdb `yaml:"cmdb"`
|
||||
Worker *Worker `yaml:"worker"`
|
||||
SshServer *SshServer `yaml:"sshServer"`
|
||||
Protocols map[string]any `yaml:"protocols"`
|
||||
|
||||
I18nDir string `yaml:"i18nDir"`
|
||||
}
|
||||
|
||||
func GetResourceTypeName(key string) (val string) {
|
||||
for _, kv := range Cfg.Auth.Acl.ResourceNames {
|
||||
if kv.Key == key {
|
||||
val = kv.Value
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
187
backend/pkg/i18n/message.go
Normal file
187
backend/pkg/i18n/message.go
Normal file
@@ -0,0 +1,187 @@
|
||||
package i18n
|
||||
|
||||
import (
|
||||
goi18n "github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
)
|
||||
|
||||
var (
|
||||
// errors
|
||||
MsgBadRequest = &goi18n.Message{
|
||||
ID: "MsgBadRequest",
|
||||
One: "Bad Request: {{.err}}",
|
||||
Other: "Bad Request: {{.err}}",
|
||||
}
|
||||
MsgInvalidArguemnt = &goi18n.Message{
|
||||
ID: "MsgArgumentError",
|
||||
One: "Bad Request: Argument is invalid, {{.err}}",
|
||||
Other: "Bad Request: Argument is invalid, {{.err}}",
|
||||
}
|
||||
MsgDupName = &goi18n.Message{
|
||||
ID: "MsgDupName",
|
||||
One: "Bad Request: {{.name}} is duplicate",
|
||||
Other: "Bad Request: {{.name}} is duplicate",
|
||||
}
|
||||
MsgHasChild = &goi18n.Message{
|
||||
ID: "MsgHasChild",
|
||||
One: "Bad Request: This folder has sub folder or assert, cannot be deleted",
|
||||
Other: "Bad Request: This folder has sub folder or assert, cannot be deleted",
|
||||
}
|
||||
MsgHasDepdency = &goi18n.Message{
|
||||
ID: "MsgHasDepdency",
|
||||
One: "Bad Request: Asset {{.name}} dependens on this, cannot be deleted",
|
||||
Other: "Bad Request: Asset {{.name}} dependens on this, cannot be deleted",
|
||||
}
|
||||
MsgNoPerm = &goi18n.Message{
|
||||
ID: "MsgNoPerm",
|
||||
One: "Bad Request: You do not have {{.perm}} permission",
|
||||
Other: "Bad Request: You do not have {{.perm}} permission",
|
||||
}
|
||||
MsgRemoteClient = &goi18n.Message{
|
||||
ID: "MsgRemote",
|
||||
One: "Bad Request: {{.message}}",
|
||||
Other: "Bad Request: {{.message}}",
|
||||
}
|
||||
MsgWrongPk = &goi18n.Message{
|
||||
ID: "MsgWrongPk",
|
||||
One: "Bad Request: Invalid SSH public key",
|
||||
Other: "Bad Request: Invalid SSH public key",
|
||||
}
|
||||
MsgWrongMac = &goi18n.Message{
|
||||
ID: "MsgWrongMac",
|
||||
One: "Bad Request: Invalid Mac address",
|
||||
Other: "Bad Request: Invalid Mac address",
|
||||
}
|
||||
MsgInvalidSessionId = &goi18n.Message{
|
||||
ID: "MsgInvalidSessionId",
|
||||
One: "Bad Request: Invalid session id {{.sessionId}}",
|
||||
Other: "Bad Request: Invalid session id {{.sessionId}}",
|
||||
}
|
||||
MsgSessionEnd = &goi18n.Message{
|
||||
ID: "MsgSessionEnd",
|
||||
One: "\n----------Session {{.sessionId}} has been ended----------\n",
|
||||
Other: "\n----------Session {{.sessionId}} has been ended----------\n",
|
||||
}
|
||||
//
|
||||
MsgInternalError = &goi18n.Message{
|
||||
ID: "MsgInternalError",
|
||||
One: "Server Error: {{.err}}",
|
||||
Other: "Server Error: {{.err}}",
|
||||
}
|
||||
MsgRemoteServer = &goi18n.Message{
|
||||
ID: "MsgRemoteServer",
|
||||
One: "Server Error: {{.message}}",
|
||||
Other: "Server Error: {{.message}}",
|
||||
}
|
||||
MsgLoadSession = &goi18n.Message{
|
||||
ID: "MsgLoadSession",
|
||||
One: "Load Session Faild",
|
||||
Other: "Load Session Faild",
|
||||
}
|
||||
MsgConnectServer = &goi18n.Message{
|
||||
ID: "MsgConnectServer",
|
||||
One: "Connect Server Error",
|
||||
Other: "Connect Server Error",
|
||||
}
|
||||
|
||||
// others
|
||||
MsgTypeMappingAccount = &goi18n.Message{
|
||||
ID: "MsgTypeMappingAccount",
|
||||
One: "Account",
|
||||
Other: "Account",
|
||||
}
|
||||
MsgTypeMappingAsset = &goi18n.Message{
|
||||
ID: "MsgTypeMappingAsset",
|
||||
One: "Asset",
|
||||
Other: "Asset",
|
||||
}
|
||||
MsgTypeMappingCommand = &goi18n.Message{
|
||||
ID: "MsgTypeMappingCommand",
|
||||
One: "Command",
|
||||
Other: "Command",
|
||||
}
|
||||
MsgTypeMappingGateway = &goi18n.Message{
|
||||
ID: "MsgTypeMappingGateway",
|
||||
One: "Gateway",
|
||||
Other: "Gateway",
|
||||
}
|
||||
MsgTypeMappingNode = &goi18n.Message{
|
||||
ID: "MsgTypeMappingNode",
|
||||
One: "Node",
|
||||
Other: "Node",
|
||||
}
|
||||
MsgTypeMappingPublicKey = &goi18n.Message{
|
||||
ID: "MsgTypeMappingPublicKey",
|
||||
One: "Public Key",
|
||||
Other: "Public Key",
|
||||
}
|
||||
|
||||
// SSH
|
||||
MsgSshShowAssetResults = &goi18n.Message{
|
||||
ID: "MsgSshShowAssetResults",
|
||||
One: "Total host count is:\033[0;32m {{.Count}} \033[0m \r\n{{.Msg}}\r\n",
|
||||
Other: "ShowAssetResultsOther",
|
||||
}
|
||||
MsgSshAccountLoginError = &goi18n.Message{
|
||||
ID: "MsgSshAccountLoginError",
|
||||
One: "\x1b[1;30;32m failed login \x1b[0m \x1b[1;30;3m {{.User}}\x1b[0m\n" +
|
||||
"\x1b[0;33m you need to choose asset again \u001B[0m\n",
|
||||
Other: "AccountLoginErrorOther",
|
||||
}
|
||||
MsgSshNoAssetPermission = &goi18n.Message{
|
||||
ID: "MsgSshNoAssetPermission",
|
||||
One: "\r\n\u001B[0;33mNo permission for[0m:\033[0;31m {{.Host}} \033[0m\r\n",
|
||||
Other: "NoAssetPermissionOther",
|
||||
}
|
||||
MsgSshNoMatchingAsset = &goi18n.Message{
|
||||
ID: "MsgSshNoMatchingAsset",
|
||||
One: "\x1b[0;33mNo matching asset for :\x1b[0m \x1b[0;94m{{.Host}} \x1b[0m\r\n",
|
||||
Other: "MsgSshNoMatchingAsset",
|
||||
}
|
||||
MsgSshNoSshAccessMethod = &goi18n.Message{
|
||||
ID: "MsgSshNoSshAccessMethod",
|
||||
One: "No ssh access method for :\033[0;31m {{.Host}} \033[0m\r\n",
|
||||
Other: "NoSshAccessMethodOther",
|
||||
}
|
||||
MsgSshNoSshAccountForAsset = &goi18n.Message{
|
||||
ID: "MsgSshNoSshAccountForAsset",
|
||||
One: "No ssh account for :\033[0;31m {{.Host}} \033[0m\r\n",
|
||||
Other: "NoSshAccountForAssetOther",
|
||||
}
|
||||
MsgSshMultiSshAccountForAsset = &goi18n.Message{
|
||||
ID: "MsgSshMultiSshAccountForAsset",
|
||||
One: "choose account: \n\033[0;31m {{.Accounts}} \033[0m\n",
|
||||
Other: "MultiSshAccountForAssetOther",
|
||||
}
|
||||
MsgSshWelcome = &goi18n.Message{
|
||||
ID: "MsgSshWelcomeMsg",
|
||||
One: "\x1b[0;47m Welcome: {{.User}} \x1b[0m\r\n" +
|
||||
" \x1b[1;30;32m /s \x1b[0m to switch language between english and 中文\r\n" +
|
||||
"\x1b[1;30;32m /* \x1b[0m to list all host which you have permission\r\n" +
|
||||
"\x1b[1;30;32m IP/hostname \x1b[0m to search and login if only one, eg. 192\r\n" +
|
||||
"\x1b[1;30;32m /q \x1b[0m to exit\r\n" +
|
||||
"\x1b[1;30;32m /? \x1b[0m for help\r\n",
|
||||
Other: "WelcomeMsgOther",
|
||||
}
|
||||
MsgSshCommandRefused = &goi18n.Message{
|
||||
ID: "MsgSshCommandRefused",
|
||||
One: "\x1b[0;31m you have no permission to execute command: \x1b[0m \x1b[0;33m{{.Command}} \x1b[0m\r\n",
|
||||
Other: "MsgSshCommandRefusedOther",
|
||||
}
|
||||
MsgSShHostIdleTimeout = &goi18n.Message{
|
||||
ID: "MsgSShHostIdleTimeout",
|
||||
One: "\r\n\x1b[0;31m disconnect since idle more than\x1b[0m \x1b[0;33m {{.Idle}} \x1b[0m\r\n",
|
||||
Other: "MsgSShHostIdleTimeoutOther",
|
||||
}
|
||||
|
||||
MsgSshAccessRefusedInTimespan = &goi18n.Message{
|
||||
ID: "MsgSshAccessRefusedInTimespan",
|
||||
One: "\r\n\x1b[0;31m disconnect since current time is not allowed \x1b[0m\r\n",
|
||||
Other: "MsgSshAccessRefusedInTimespanOther",
|
||||
}
|
||||
|
||||
MsgSShWelcomeForHelp = &goi18n.Message{
|
||||
ID: "MsgSShWelcomeForHelp",
|
||||
One: "\x1b[31;47m Welcome: {{.User}}",
|
||||
Other: "MsgSShWelcomeForHelp",
|
||||
}
|
||||
)
|
167
backend/pkg/i18n/translate/active.en.toml
Normal file
167
backend/pkg/i18n/translate/active.en.toml
Normal file
@@ -0,0 +1,167 @@
|
||||
[MsgArgumentError]
|
||||
hash = "sha1-362dc86add63740c0adfc87b90fa6d1a76b0af2d"
|
||||
many = "Bad Request: Argument is invalid, {{.err}}"
|
||||
one = "Bad Request: Argument is invalid, {{.err}}"
|
||||
other = "Bad Request: Argument is invalid, {{.err}}"
|
||||
|
||||
[MsgBadRequest]
|
||||
hash = "sha1-ce2a43b7dbe690adefef142f93b5f37e29ceb5f9"
|
||||
many = "Bad Request: {{.err}}"
|
||||
one = "Bad Request: {{.err}}"
|
||||
other = "Bad Request: {{.err}}"
|
||||
|
||||
[MsgConnectServer]
|
||||
hash = "sha1-3d9e42d4d82b873203fef24cf7865de8c64d9dc4"
|
||||
many = "Connect Server Error"
|
||||
one = "Connect Server Error"
|
||||
other = "Connect Server Error"
|
||||
|
||||
[MsgDupName]
|
||||
hash = "sha1-e170045255d10872b5cbcf32f29c0fdbcebb8d6c"
|
||||
many = "Bad Request: {{.name}} is duplicate"
|
||||
one = "Bad Request: {{.name}} is duplicate"
|
||||
other = "Bad Request: {{.name}} is duplicate"
|
||||
|
||||
[MsgHasChild]
|
||||
hash = "sha1-657547f2a971f07890ee54e5a5b3d15801efef9d"
|
||||
many = "Bad Request: This folder has sub folder or assert, cannot be deleted"
|
||||
one = "Bad Request: This folder has sub folder or assert, cannot be deleted"
|
||||
other = "Bad Request: This folder has sub folder or assert, cannot be deleted"
|
||||
|
||||
[MsgHasDepdency]
|
||||
hash = "sha1-742d552bba52b9dedec287d46b70f6bc810dc759"
|
||||
many = "Bad Request: Asset {{.name}} dependens on this, cannot be deleted"
|
||||
one = "Bad Request: Asset {{.name}} dependens on this, cannot be deleted"
|
||||
other = "Bad Request: Asset {{.name}} dependens on this, cannot be deleted"
|
||||
|
||||
[MsgInternalError]
|
||||
hash = "sha1-a52fb3157738021674255481e2e949e83064dd2b"
|
||||
many = "Server Error: {{.err}}"
|
||||
one = "Server Error: {{.err}}"
|
||||
other = "Server Error: {{.err}}"
|
||||
|
||||
[MsgInvalidSessionId]
|
||||
hash = "sha1-cde5615d9fe5010a47a5572c5bbdd379d5d9bf41"
|
||||
many = "Bad Request: Invalid session id {{.sessionId}}"
|
||||
one = "Bad Request: Invalid session id {{.sessionId}}"
|
||||
other = "Bad Request: Invalid session id {{.sessionId}}"
|
||||
|
||||
[MsgLoadSession]
|
||||
hash = "sha1-58aa1fb9d4e3648849877723a19dc64634e1da3d"
|
||||
many = "Load Session Faild"
|
||||
one = "Load Session Faild"
|
||||
other = "Load Session Faild"
|
||||
|
||||
[MsgNoPerm]
|
||||
hash = "sha1-086946e776d00a6f09fbae8f3df244cd2160f433"
|
||||
many = "Bad Request: You do not have {{.perm}} permission"
|
||||
one = "Bad Request: You do not have {{.perm}} permission"
|
||||
other = "Bad Request: You do not have {{.perm}} permission"
|
||||
|
||||
[MsgRemote]
|
||||
hash = "sha1-0c6217c9a4b713d7ab02d8422a8ae7f3339e31ec"
|
||||
many = "Bad Request: {{.message}}"
|
||||
one = "Bad Request: {{.message}}"
|
||||
other = "Bad Request: {{.message}}"
|
||||
|
||||
[MsgRemoteServer]
|
||||
hash = "sha1-1b419a55cf846d5f9779b2e883cc9f4c5c89aa9d"
|
||||
many = "Server Error: {{.message}}"
|
||||
one = "Server Error: {{.message}}"
|
||||
other = "Server Error: {{.message}}"
|
||||
|
||||
[MsgSessionEnd]
|
||||
hash = "sha1-1dec3e3125610522edc06e644f321d1a9c166508"
|
||||
many = "\n----------Session {{.sessionId}} has been ended----------\n"
|
||||
one = "\n----------Session {{.sessionId}} has been ended----------\n"
|
||||
other = "\n----------Session {{.sessionId}} has been ended----------\n"
|
||||
|
||||
[MsgSshAccountLoginError]
|
||||
hash = "sha1-56b115cbab2672d62913f0be2533b286213f5697"
|
||||
many = "AccountLoginErrorOther"
|
||||
one = "\u001b[1;30;32m failed login \u001b[0m \u001b[4;30;3m {{.User}}\u001b[0m\n\u001b[0;33m you need to choose asset again \u001b[0m\n"
|
||||
other = "AccountLoginErrorOther"
|
||||
|
||||
[MsgSshMultiSshAccountForAsset]
|
||||
hash = "sha1-610e0729478a3bcf0dbd20ba8d2ac99285ef1203"
|
||||
many = "MultiSshAccountForAssetOther"
|
||||
one = "choose account: \n\u001b[0;31m {{.Accounts}} \u001b[0m\n"
|
||||
other = "MultiSshAccountForAssetOther"
|
||||
|
||||
[MsgSshNoAssetPermission]
|
||||
hash = "sha1-c2e665e88c6439ed5be62508c90171fbe6dc5124"
|
||||
many = "NoAssetPermissionOther"
|
||||
one = "No permission for :\u001b[0;31m {{.Host}} \u001b[0m\r\n"
|
||||
other = "NoAssetPermissionOther"
|
||||
|
||||
[MsgSshNoSshAccessMethod]
|
||||
hash = "sha1-c6687b9f627968f6a94050ea5651ba8198ff022f"
|
||||
many = "NoSshAccessMethodOther"
|
||||
one = "No ssh access method for :\u001b[0;31m {{.Host}} \u001b[0m\r\n"
|
||||
other = "NoSshAccessMethodOther"
|
||||
|
||||
[MsgSshNoSshAccountForAsset]
|
||||
hash = "sha1-361247824ccc685fc82ef91ed0d67dbeab9e01cb"
|
||||
many = "NoSshAccountForAssetOther"
|
||||
one = "No ssh account for :\u001b[0;31m {{.Host}} \u001b[0m\r\n"
|
||||
other = "NoSshAccountForAssetOther"
|
||||
|
||||
[MsgSshShowAssetResults]
|
||||
hash = "sha1-2911e21b4a1a6c46cc67c8212c6918c8f4ce8d32"
|
||||
many = "ShowAssetResultsOther"
|
||||
one = "Total host count is:\u001b[0;32m {{.Count}} \u001b[0m \r\n{{.Msg}}\r\n"
|
||||
other = "ShowAssetResultsOther"
|
||||
|
||||
[MsgSshWelcomeMsg]
|
||||
hash = "sha1-764a3cb5c081536d5f574875ab5758d9b26942e8"
|
||||
many = "WelcomeMsgOther"
|
||||
one = "\u001b[0;33m Current User: {{.User}} \u001b[0m\r\n\u001b[1;30;32m IP/hostname \u001b[0m to search and login if only one, eg. 192\r\n\u001b[1;30;32m /s \u001b[0m to switch language between english and 中文\r\n\u001b[1;30;32m /* \u001b[0m to list all host which you have permission\r\n\u001b[1;30;32m /q \u001b[0m to exit\r\n\u001b[1;30;32m ? \u001b[0m for help\r\n"
|
||||
other = "\u001b[0;33m Current User: {{.User}} \u001b[0m\r\n\u001b[1;30;32m IP/hostname \u001b[0m to search and login if only one, eg. 192\r\n\u001b[1;30;32m /s \u001b[0m to switch language between english and 中文\r\n\u001b[1;30;32m /* \u001b[0m to list all host which you have permission\r\n\u001b[1;30;32m /q \u001b[0m to exit\r\n\u001b[1;30;32m ? \u001b[0m for help\r\n"
|
||||
|
||||
[MsgTypeMappingAccount]
|
||||
one = "Account"
|
||||
other = "Account"
|
||||
|
||||
[MsgTypeMappingAsset]
|
||||
one = "Asset"
|
||||
other = "Asset"
|
||||
|
||||
[MsgTypeMappingCommand]
|
||||
one = "Command"
|
||||
other = "Command"
|
||||
|
||||
[MsgTypeMappingGateway]
|
||||
one = "Gateway"
|
||||
other = "Gateway"
|
||||
|
||||
[MsgTypeMappingNode]
|
||||
one = "Node"
|
||||
other = "Node"
|
||||
|
||||
[MsgTypeMappingPublicKey]
|
||||
one = "Public Key"
|
||||
other = "Public Key"
|
||||
|
||||
[MsgWrongMac]
|
||||
one = "Bad Request: Invalid Mac address"
|
||||
other = "Bad Request: Invalid Mac address"
|
||||
|
||||
[MsgWrongPk]
|
||||
one = "Bad Request: Invalid SSH public key"
|
||||
other = "Bad Request: Invalid SSH public key"
|
||||
|
||||
[MsgSshCommandRefused]
|
||||
one = "\u001b[0;31m you have no permission to execute command: \u001b[0m \u001b[0;33m{{.Command}} \u001b[0m\r\n"
|
||||
other= "\u001b[0;31m you have no permission to execute command: \u001b[0m \u001b[0;33m{{.Command}} \u001b[0m\r\n"
|
||||
|
||||
[MsgSshNoMatchingAsset]
|
||||
one = "\u001b[0;33mNo matching asset for :\u001b[0m \u001b[4;94m{{.Host}} \u001b[0m\r\n"
|
||||
other = "MsgSshNoMatchingAsset"
|
||||
|
||||
[MsgSShHostIdleTimeout]
|
||||
one = "\r\n\u001b[0;31m disconnect since idle more than\u001b[0m \u001b[0;33m {{.Idle}} \u001b[0m\r\n"
|
||||
other = "\r\n\u001b[0;31m disconnect since idle more than\u001b[0m \u001b[0;33m {{.Idle}} \u001b[0m\r\n"
|
||||
|
||||
[MsgSshAccessRefusedInTimespan]
|
||||
one = "\r\n\u001b[0;31m disconnect since current time is not allowed \u001b[0m\r\n"
|
||||
other = "\r\n\u001b[0;31m disconnect since current time is not allowed \u001b[0m\r\n"
|
159
backend/pkg/i18n/translate/active.zh.toml
Normal file
159
backend/pkg/i18n/translate/active.zh.toml
Normal file
@@ -0,0 +1,159 @@
|
||||
[MsgArgumentError]
|
||||
hash = "sha1-362dc86add63740c0adfc87b90fa6d1a76b0af2d"
|
||||
other = "请求错误: 参数不合法, {{.err}}"
|
||||
|
||||
[MsgBadRequest]
|
||||
hash = "sha1-ce2a43b7dbe690adefef142f93b5f37e29ceb5f9"
|
||||
other = "请求错误: {{.err}}"
|
||||
|
||||
[MsgConnectServer]
|
||||
hash = "sha1-3d9e42d4d82b873203fef24cf7865de8c64d9dc4"
|
||||
other = "连接SSH服务器失败"
|
||||
|
||||
[MsgDupName]
|
||||
hash = "sha1-e170045255d10872b5cbcf32f29c0fdbcebb8d6c"
|
||||
other = "请求错误: {{.name}} 重复"
|
||||
|
||||
[MsgHasChild]
|
||||
hash = "sha1-657547f2a971f07890ee54e5a5b3d15801efef9d"
|
||||
other = "请求错误: 该文件夹包含子文件夹或资产,无法删除"
|
||||
|
||||
[MsgHasDepdency]
|
||||
hash = "sha1-742d552bba52b9dedec287d46b70f6bc810dc759"
|
||||
other = "请求错误: 资产 {{.name}} 依赖该项,无法删除"
|
||||
|
||||
[MsgInternalError]
|
||||
hash = "sha1-a52fb3157738021674255481e2e949e83064dd2b"
|
||||
other = "服务错误: {{.err}}"
|
||||
|
||||
[MsgInvalidSessionId]
|
||||
hash = "sha1-cde5615d9fe5010a47a5572c5bbdd379d5d9bf41"
|
||||
other = "请求错误: 非法会话ID {{.sessionId}}"
|
||||
|
||||
[MsgLoadSession]
|
||||
hash = "sha1-58aa1fb9d4e3648849877723a19dc64634e1da3d"
|
||||
other = "加载会话失败"
|
||||
|
||||
[MsgNoPerm]
|
||||
hash = "sha1-086946e776d00a6f09fbae8f3df244cd2160f433"
|
||||
other = "请求错误: 您没有{{.perm}} 权限"
|
||||
|
||||
[MsgRemote]
|
||||
hash = "sha1-0c6217c9a4b713d7ab02d8422a8ae7f3339e31ec"
|
||||
other = "请求错误: {{.message}}"
|
||||
|
||||
[MsgRemoteServer]
|
||||
hash = "sha1-1b419a55cf846d5f9779b2e883cc9f4c5c89aa9d"
|
||||
other = "服务错误: {{.message}}"
|
||||
|
||||
|
||||
[MsgSessionEnd]
|
||||
hash = "sha1-1dec3e3125610522edc06e644f321d1a9c166508"
|
||||
other = "\n----------会话 {{.sessionId}} 已被关闭----------\n"
|
||||
|
||||
[MsgTypeMappingAccount]
|
||||
hash = "sha1-85dfa32c97d8618d1bea083609e2c8a29845abe5"
|
||||
other = "账号"
|
||||
|
||||
[MsgTypeMappingAsset]
|
||||
hash = "sha1-4426afd90a77a35fb37ebd7110b9989cf7bed224"
|
||||
other = "资产"
|
||||
|
||||
[MsgTypeMappingCommand]
|
||||
hash = "sha1-8901895fb1b1d4c4ea2fec368c25176bf73e2f7e"
|
||||
other = "命令"
|
||||
|
||||
[MsgTypeMappingGateway]
|
||||
hash = "sha1-5a0e1818803b6bbdbb0cb77d88080aeaff8b5d2a"
|
||||
other = "网关"
|
||||
|
||||
[MsgTypeMappingNode]
|
||||
hash = "sha1-260f7a8cd4f6938b3cc185a619847cb83d670219"
|
||||
other = "文件夹"
|
||||
|
||||
[MsgTypeMappingPublicKey]
|
||||
hash = "sha1-590e3d26e76d9c4e5fe2aaf976d54d1f46cb8b31"
|
||||
other = "公钥"
|
||||
|
||||
|
||||
[MsgWrongMac]
|
||||
hash = "sha1-2b836bb6de89fdc386c739b6ce1d0f61959de02e"
|
||||
other = "请求错误: 非法MAC地址"
|
||||
|
||||
[MsgWrongPk]
|
||||
hash = "sha1-9859553174705cf52d08a18fab79dc3e05a0230f"
|
||||
other = "请求错误: 非法SSH公钥"
|
||||
|
||||
|
||||
[MsgSshAccountLoginError]
|
||||
hash = "sha1-56b115cbab2672d62913f0be2533b286213f5697"
|
||||
many = "AccountLoginErrorOther"
|
||||
one = "\u001b[1;30;32m 登录失败 \u001b[0m \u001b[1;30;3m {{.User}}\u001b[0m\n\u001b[0;33m 请重新选择资产 \u001b[0m\n"
|
||||
other = "\u001b[1;30;32m 登录失败 \u001b[0m \u001b[1;30;3m {{.User}}\u001b[0m\n\u001b[0;33m 请重新选择资产 \u001b[0m\n"
|
||||
|
||||
|
||||
[MsgSshMultiSshAccountForAsset]
|
||||
hash = "sha1-610e0729478a3bcf0dbd20ba8d2ac99285ef1203"
|
||||
many = "MultiSshAccountForAssetOther2"
|
||||
one = "选择账户: \n\u001b[0;31m {{.Accounts}} \u001b[0m\n"
|
||||
other = "选择账户: \n\u001b[0;31m {{.Accounts}} \u001b[0m\n"
|
||||
|
||||
[MsgSshNoAssetPermission]
|
||||
hash = "sha1-c2e665e88c6439ed5be62508c90171fbe6dc5124"
|
||||
many = "NoAssetPermissionOther"
|
||||
one = "\r\n[0;31m没有权限[0m:\u001b[0;33m {{.Host}} \u001b[0m\r\n"
|
||||
other = "\r\n[0;31m没有权限[0m:\u001b[0;33m {{.Host}} \u001b[0m\r\n"
|
||||
|
||||
[MsgSshNoSshAccessMethod]
|
||||
hash = "sha1-c6687b9f627968f6a94050ea5651ba8198ff022f"
|
||||
many = "NoSshAccessMethodOther"
|
||||
one = "没有权限 :\u001b[0;31m {{.Host}} \u001b[0m\r\n"
|
||||
other = "没有权限 :\u001b[0;31m {{.Host}} \u001b[0m\r\n"
|
||||
|
||||
[MsgSshNoSshAccountForAsset]
|
||||
hash = "sha1-361247824ccc685fc82ef91ed0d67dbeab9e01cb"
|
||||
many = "NoSshAccountForAssetOther"
|
||||
one = "没有ssh登录账户 :\u001b[0;31m {{.Host}} \u001b[0m\r\n"
|
||||
other = "没有ssh登录账户 :\u001b[0;31m {{.Host}} \u001b[0m\r\n"
|
||||
|
||||
[MsgSshShowAssetResults]
|
||||
hash = "sha1-2911e21b4a1a6c46cc67c8212c6918c8f4ce8d32"
|
||||
many = "ShowAssetResultsOther"
|
||||
one = "资产总数:\u001b[0;32m {{.Count}} \u001b[0m \r\n{{.Msg}}\r\n"
|
||||
other = "资产总数:\u001b[0;32m {{.Count}} \u001b[0m \r\n{{.Msg}}\r\n"
|
||||
|
||||
#[MsgSshWelcomeMsg]
|
||||
#hash = "sha1-764a3cb5c081536d5f574875ab5758d9b26942e8"
|
||||
#many = "WelcomeMsgOther"
|
||||
#one = " \u001b[0;33m 当前用户: \u001b[0;34m{{.User}} \u001b[0m\r\n\u001b[1;30;32m s \u001b[0m 切换语言 中文/English \r\n\u001b[1;30;32m h \u001b[0m 列出所有有权限的资产\r\n\u001b[1;30;32m IP/hostname \u001b[0m 搜索资产直接登录\n\u001b[1;30;32m q \u001b[0m 退出\r\n\u001b[1;30;32m ? \u001b[0m 帮助\r\n"
|
||||
#other = " \u001b[0;33m 当前用户: \u001b[0;34m{{.User}} \u001b[0m\r\n\u001b[1;30;32m s \u001b[0m 切换语言 中文/English \r\n\u001b[1;30;32m h \u001b[0m 列出所有有权限的资产\r\n\u001b[1;30;32m IP/hostname \u001b[0m 搜素资产直接登录\r\n\u001b[1;30;32m q \u001b[0m 退出\r\n\u001b[1;30;32m ? \u001b[0m 帮助\r\n"
|
||||
|
||||
[MsgSshWelcomeMsg]
|
||||
hash = "sha1-764a3cb5c081536d5f574875ab5758d9b26942e8"
|
||||
many = "WelcomeMsgOther"
|
||||
one = " \u001b[0;33m 当前用户: \u001b[0;34m{{.User}} \u001b[0m\r\n\u001b[1;30;32m IP/hostname \u001b[0m 搜索资产直接登录,如直接输入192\r\n\u001b[1;30;32m /s \u001b[0m 切换语言 中文/English \r\n\u001b[1;30;32m /* \u001b[0m 列出所有有权限的资产\r\n\u001b[1;30;32m /q \u001b[0m 退出\r\n\u001b[1;30;32m /? \u001b[0m 帮助\r\n"
|
||||
other = " \u001b[0;33m 当前用户: \u001b[0;34m{{.User}} \u001b[0m\r\n\u001b[1;30;32m IP/hostname \u001b[0m 搜索资产直接登录,如直接输入192\r\n\u001b[1;30;32m /s \u001b[0m 切换语言 中文/English \r\n\u001b[1;30;32m /* \u001b[0m 列出所有有权限的资产\r\n\u001b[1;30;32m /q \u001b[0m 退出\r\n\u001b[1;30;32m /? \u001b[0m 帮助\r\n"
|
||||
|
||||
[MsgSshCommandRefused]
|
||||
hash = "sha1-031b693c06cc0c4d4efe6dc55ae0a0889cce4961"
|
||||
many = "MsgSshCommandRefusedOther"
|
||||
one = "\u001b[0;31m 您没有权限执行命令: \u001b[0m \u001b[0;33m{{.Command}} \u001b[0m\r\n"
|
||||
other = "\u001b[0;31m 您没有权限执行命令: \u001b[0m \u001b[0;33m{{.Command}} \u001b[0m\n\n"
|
||||
|
||||
[MsgSshNoMatchingAsset]
|
||||
hash = "sha1-33427b03e4f1d680658894727fa8f39a5a471742"
|
||||
many = "MsgSshNoMatchingAsset"
|
||||
one = " \u001b[0;33m没有匹配的资产 :\u001b[0m \u001b[4;94m{{.Host}} \u001b[0m\r\n"
|
||||
other = " \u001b[0;33m没有匹配的资产 :\u001b[0m \u001b[4;94m{{.Host}} \u001b[0m\r\n"
|
||||
|
||||
[MsgSShHostIdleTimeout]
|
||||
hash = "sha1-f0bd6c36675dc3b36a5b116d68956fdacfc3f1ab"
|
||||
many = "MsgSShHostIdleTimeoutOther"
|
||||
one = "\r\n\u001b[0;31m 断开连接,空闲连接时长超过\u001b[0m \u001b[0;33m {{.Idle}} \u001b[0m\r\n"
|
||||
other = "\r\n\u001b[0;31m 断开连接,空闲连接时长超过\u001b[0m \u001b[0;33m {{.Idle}} \u001b[0m\r\n"
|
||||
|
||||
[MsgSshAccessRefusedInTimespan]
|
||||
hash = "sha1-db8ac7e4e4acc918ff7be914e4750dec37f0aa39"
|
||||
many = "MsgSshAccessRefusedInTimespanOther"
|
||||
one = "\r\n\u001b[0;31m 断开连接, 当前时段没有权限 \u001b[0m\r\n"
|
||||
oother = "\r\n\u001b[0;31m 断开连接, 当前时段没有权限 \u001b[0m\r\n"
|
31
backend/pkg/i18n/translate/translate.zh.toml
Normal file
31
backend/pkg/i18n/translate/translate.zh.toml
Normal file
@@ -0,0 +1,31 @@
|
||||
[MsgTypeMappingAccount]
|
||||
hash = "sha1-85dfa32c97d8618d1bea083609e2c8a29845abe5"
|
||||
other = "账号"
|
||||
|
||||
[MsgTypeMappingAsset]
|
||||
hash = "sha1-4426afd90a77a35fb37ebd7110b9989cf7bed224"
|
||||
other = "资产"
|
||||
|
||||
[MsgTypeMappingCommand]
|
||||
hash = "sha1-8901895fb1b1d4c4ea2fec368c25176bf73e2f7e"
|
||||
other = "命令"
|
||||
|
||||
[MsgTypeMappingGateway]
|
||||
hash = "sha1-5a0e1818803b6bbdbb0cb77d88080aeaff8b5d2a"
|
||||
other = "网关"
|
||||
|
||||
[MsgTypeMappingNode]
|
||||
hash = "sha1-260f7a8cd4f6938b3cc185a619847cb83d670219"
|
||||
other = "文件夹"
|
||||
|
||||
[MsgTypeMappingPublicKey]
|
||||
hash = "sha1-590e3d26e76d9c4e5fe2aaf976d54d1f46cb8b31"
|
||||
other = "公钥"
|
||||
|
||||
[MsgWrongMac]
|
||||
hash = "sha1-2b836bb6de89fdc386c739b6ce1d0f61959de02e"
|
||||
other = "请求错误: 非法MAC地址"
|
||||
|
||||
[MsgWrongPk]
|
||||
hash = "sha1-9859553174705cf52d08a18fab79dc3e05a0230f"
|
||||
other = "请求错误: 非法SSH公钥"
|
93
backend/pkg/logger/logger.go
Normal file
93
backend/pkg/logger/logger.go
Normal file
@@ -0,0 +1,93 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
"gopkg.in/natefinch/lumberjack.v2"
|
||||
|
||||
"github.com/veops/oneterm/pkg/conf"
|
||||
)
|
||||
|
||||
var (
|
||||
L *zap.Logger
|
||||
AtomicLevel = zap.NewAtomicLevel()
|
||||
)
|
||||
|
||||
func Init(ctx context.Context, cfg *conf.LogConfig) (err error) {
|
||||
err = initLogger(cfg)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
L = zap.L()
|
||||
|
||||
go func() {
|
||||
<-ctx.Done()
|
||||
err = L.Sync()
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func getEncoder(format string) zapcore.Encoder {
|
||||
|
||||
encodeConfig := zap.NewProductionEncoderConfig()
|
||||
encodeConfig.EncodeTime = zapcore.ISO8601TimeEncoder
|
||||
encodeConfig.TimeKey = "time"
|
||||
encodeConfig.EncodeLevel = zapcore.CapitalLevelEncoder
|
||||
encodeConfig.EncodeCaller = zapcore.ShortCallerEncoder
|
||||
|
||||
if strings.ToUpper(format) == "JSON" {
|
||||
return zapcore.NewJSONEncoder(encodeConfig)
|
||||
} else {
|
||||
encodeConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder
|
||||
return zapcore.NewConsoleEncoder(encodeConfig)
|
||||
}
|
||||
}
|
||||
|
||||
func getLogWriter(cfg *conf.LogConfig) zapcore.Core {
|
||||
var cores []zapcore.Core
|
||||
|
||||
if cfg.Path != "" {
|
||||
logRotate := &lumberjack.Logger{
|
||||
Filename: cfg.Path,
|
||||
MaxSize: cfg.MaxSize,
|
||||
MaxBackups: cfg.MaxBackups,
|
||||
MaxAge: cfg.MaxAge,
|
||||
Compress: cfg.Compress,
|
||||
}
|
||||
fileEncoder := getEncoder(cfg.Format)
|
||||
cores = append(cores, zapcore.NewCore(fileEncoder, zapcore.AddSync(logRotate), AtomicLevel))
|
||||
}
|
||||
|
||||
if cfg.ConsoleEnable {
|
||||
consoleEncoder := getEncoder("console")
|
||||
cores = append(cores, zapcore.NewCore(consoleEncoder, zapcore.Lock(os.Stdout), AtomicLevel))
|
||||
}
|
||||
|
||||
return zapcore.NewTee(cores...)
|
||||
}
|
||||
|
||||
func initLogger(cfg *conf.LogConfig) (err error) {
|
||||
|
||||
level, err := zap.ParseAtomicLevel(cfg.Level)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
AtomicLevel.SetLevel(level.Level())
|
||||
|
||||
core := getLogWriter(cfg)
|
||||
|
||||
logger := zap.New(core, zap.AddCaller())
|
||||
zap.ReplaceGlobals(logger)
|
||||
|
||||
return
|
||||
}
|
20
backend/pkg/proto/ssh/api/api.go
Normal file
20
backend/pkg/proto/ssh/api/api.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package api
|
||||
|
||||
type Authentication interface {
|
||||
Authenticate() (token string, err error)
|
||||
}
|
||||
|
||||
type Asset interface {
|
||||
Groups() (any, error)
|
||||
Lists() (any, error)
|
||||
}
|
||||
|
||||
type Audit interface {
|
||||
NewSession(data any) error
|
||||
}
|
||||
|
||||
type Core interface {
|
||||
Authentication
|
||||
Audit
|
||||
Asset
|
||||
}
|
194
backend/pkg/proto/ssh/api/asset.go
Normal file
194
backend/pkg/proto/ssh/api/asset.go
Normal file
@@ -0,0 +1,194 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-resty/resty/v2"
|
||||
|
||||
cfg "github.com/veops/oneterm/pkg/proto/ssh/config"
|
||||
"github.com/veops/oneterm/pkg/server/controller"
|
||||
"github.com/veops/oneterm/pkg/server/model"
|
||||
"github.com/veops/oneterm/pkg/util"
|
||||
)
|
||||
|
||||
type AssetCore struct {
|
||||
Api string
|
||||
XToken string
|
||||
}
|
||||
|
||||
func NewAssetServer(Api, token string) *AssetCore {
|
||||
return &AssetCore{
|
||||
Api: Api,
|
||||
XToken: token,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *AssetCore) Groups() (res any, err error) {
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (a *AssetCore) Lists(cookie, search string, id int) (res *controller.ListData, err error) {
|
||||
client := resty.New()
|
||||
|
||||
var (
|
||||
data *controller.HttpResponse
|
||||
)
|
||||
|
||||
params := map[string]string{
|
||||
"page_index": "1",
|
||||
"page_size": "-1",
|
||||
"info": "true",
|
||||
}
|
||||
if strings.TrimSpace(search) != "" {
|
||||
params["search"] = search
|
||||
}
|
||||
if id > 0 {
|
||||
params["id"] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
resp, err := client.R().
|
||||
SetQueryParams(params).
|
||||
SetHeader("Cookie", cookie).
|
||||
SetHeader("X-Token", a.XToken).
|
||||
SetResult(&data).
|
||||
Get(strings.TrimSuffix(a.Api, "/") + assetUrl)
|
||||
if err != nil {
|
||||
return res, fmt.Errorf("api request error:%v", err.Error())
|
||||
}
|
||||
if resp.StatusCode() != 200 {
|
||||
return res, fmt.Errorf("auth code: %d %v", resp.StatusCode(), string(resp.Body()))
|
||||
}
|
||||
if data.Code != 0 {
|
||||
return res, fmt.Errorf(data.Message)
|
||||
}
|
||||
err = util.DecodeStruct(&res, data.Data)
|
||||
return
|
||||
}
|
||||
|
||||
func (a *AssetCore) AllAssets() (res []*model.Asset, err error) {
|
||||
params := map[string]string{
|
||||
"page_index": "1",
|
||||
"page_size": "-1",
|
||||
}
|
||||
resp, err := request(resty.MethodGet,
|
||||
a.Api+assetTotalUrl,
|
||||
map[string]string{"X-Token": a.XToken}, params, nil)
|
||||
if resp != nil {
|
||||
for _, v := range resp.List {
|
||||
var v1 model.Asset
|
||||
_ = util.DecodeStruct(&v1, v)
|
||||
res = append(res, &v1)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (a *AssetCore) HasPermission(data *model.AccessAuth) bool {
|
||||
now := time.Now()
|
||||
in := true
|
||||
if (data.Start != nil && now.Before(*data.Start)) || (data.End != nil && now.After(*data.End)) {
|
||||
in = false
|
||||
}
|
||||
if !in {
|
||||
return false
|
||||
}
|
||||
in = false
|
||||
week, hm := now.Weekday(), now.Format("15:04")
|
||||
for _, r := range data.Ranges {
|
||||
if (r.Week+1)%7 == int(week) {
|
||||
for _, str := range r.Times {
|
||||
ss := strings.Split(str, "~")
|
||||
in = in || (len(ss) >= 2 && hm >= ss[0] && hm <= ss[1])
|
||||
}
|
||||
}
|
||||
}
|
||||
return in == data.Allow
|
||||
}
|
||||
|
||||
func (a *AssetCore) Gateway(cookie string, id int) (res *model.Gateway, err error) {
|
||||
params := map[string]string{
|
||||
"page_index": "1",
|
||||
"page_size": "1",
|
||||
"info": "true",
|
||||
}
|
||||
if id > 0 {
|
||||
params["id"] = fmt.Sprintf("%d", id)
|
||||
}
|
||||
|
||||
data, err := request(resty.MethodGet,
|
||||
fmt.Sprintf("%s%s", strings.TrimSuffix(cfg.SSHConfig.Api, "/"), gatewayUrl),
|
||||
map[string]string{
|
||||
"Cookie": cookie,
|
||||
"X-Token": cfg.SSHConfig.Token,
|
||||
}, params, nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var r1 controller.ListData
|
||||
err = util.DecodeStruct(&r1, data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if len(r1.List) == 0 {
|
||||
err = fmt.Errorf("not found gateway for %d", id)
|
||||
return
|
||||
}
|
||||
err = util.DecodeStruct(&res, r1.List[0])
|
||||
return
|
||||
}
|
||||
|
||||
func (a *AssetCore) Commands(cookie string) (res []*model.Command, err error) {
|
||||
params := map[string]string{
|
||||
"page_index": "1",
|
||||
"page_size": "-1",
|
||||
"info": "true",
|
||||
}
|
||||
|
||||
data, err := request(resty.MethodGet,
|
||||
fmt.Sprintf("%s%s", strings.TrimSuffix(cfg.SSHConfig.Api, "/"), commandUrl),
|
||||
map[string]string{
|
||||
"Cookie": cookie,
|
||||
"X-Token": cfg.SSHConfig.Token,
|
||||
}, params, nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var r1 controller.ListData
|
||||
err = util.DecodeStruct(&r1, data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = util.DecodeStruct(&res, r1.List)
|
||||
return
|
||||
}
|
||||
|
||||
func (a *AssetCore) Config(cookie string) (res *model.Config, err error) {
|
||||
params := map[string]string{
|
||||
"info": "true",
|
||||
}
|
||||
data := &controller.HttpResponse{}
|
||||
_, err = resty.New().R().
|
||||
SetQueryParams(params).
|
||||
SetHeaders(map[string]string{
|
||||
"Cookie": cookie,
|
||||
"X-Token": cfg.SSHConfig.Token,
|
||||
}).
|
||||
SetResult(data).
|
||||
Get(strings.TrimSuffix(a.Api, "/") + configUrl)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = util.DecodeStruct(&res, data.Data)
|
||||
return
|
||||
}
|
||||
|
||||
func (a *AssetCore) ChangeState(data map[int]map[string]any) error {
|
||||
_, err := request(resty.MethodPut,
|
||||
strings.TrimSuffix(a.Api, "/")+assetUpdateState,
|
||||
map[string]string{
|
||||
"X-Token": cfg.SSHConfig.Token,
|
||||
}, nil, data)
|
||||
return err
|
||||
}
|
105
backend/pkg/proto/ssh/api/audit.go
Normal file
105
backend/pkg/proto/ssh/api/audit.go
Normal file
@@ -0,0 +1,105 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/go-resty/resty/v2"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/veops/oneterm/pkg/logger"
|
||||
cfg "github.com/veops/oneterm/pkg/proto/ssh/config"
|
||||
"github.com/veops/oneterm/pkg/server/controller"
|
||||
"github.com/veops/oneterm/pkg/util"
|
||||
)
|
||||
|
||||
type AuditCore struct {
|
||||
Api string
|
||||
XToken string
|
||||
}
|
||||
|
||||
func NewAuditServer(Api, token string) *Auth {
|
||||
return &Auth{
|
||||
Api: Api,
|
||||
XToken: token,
|
||||
}
|
||||
}
|
||||
|
||||
type CommandLevel int
|
||||
|
||||
const (
|
||||
CommandLevelNormal = iota + 1
|
||||
CommandLevelReject
|
||||
)
|
||||
|
||||
func (a *AuditCore) NewSession(data any) error {
|
||||
_, err := request(resty.MethodPost,
|
||||
fmt.Sprintf("%s%s", strings.TrimSuffix(cfg.SSHConfig.Api, "/"), sessionUrl),
|
||||
map[string]string{
|
||||
"X-Token": cfg.SSHConfig.Token,
|
||||
}, nil, data)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *AuditCore) AddCommand(data any) {
|
||||
_, err := request(resty.MethodPost,
|
||||
fmt.Sprintf("%s%s", strings.TrimSuffix(cfg.SSHConfig.Api, "/"), sessionCmdUrl),
|
||||
map[string]string{
|
||||
"X-Token": cfg.SSHConfig.Token,
|
||||
"Content-Type": "application/json",
|
||||
}, nil, data)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func AddReplay(sessionId string, data any) error {
|
||||
_, err := request(resty.MethodPost,
|
||||
fmt.Sprintf("%s%s/%s", strings.TrimSuffix(cfg.SSHConfig.Api, "/"), replayUrl, sessionId),
|
||||
map[string]string{
|
||||
"X-Token": cfg.SSHConfig.Token,
|
||||
}, nil, data)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func AddReplayFile(sessionId, filePath string) (err error) {
|
||||
var response *controller.HttpResponse
|
||||
r, er := resty.New().R().SetFile("replay.cast", filePath).
|
||||
SetHeader("X-Token", cfg.SSHConfig.Token).
|
||||
SetHeader("Content-Type", "application/json").
|
||||
SetBody(map[string]any{
|
||||
"session_id": sessionId,
|
||||
"body": "",
|
||||
}).SetResult(&response).Post(fmt.Sprintf("%s%s/%s", strings.TrimSuffix(cfg.SSHConfig.Api, "/"), replayFileUrl, sessionId))
|
||||
if er != nil {
|
||||
err = er
|
||||
return err
|
||||
}
|
||||
if r.StatusCode() != 200 {
|
||||
err = fmt.Errorf("auth code: %d: %s", r.StatusCode(), r.String())
|
||||
return
|
||||
}
|
||||
if response.Code != 0 {
|
||||
err = fmt.Errorf(response.Message)
|
||||
return
|
||||
}
|
||||
err = util.DecodeStruct(&response, response.Data)
|
||||
return err
|
||||
}
|
||||
|
||||
func GetCommandLevel(command string, commands []string) CommandLevel {
|
||||
for _, v := range commands {
|
||||
pattern, err := regexp.Compile(v)
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error(), zap.String("module", ""))
|
||||
continue
|
||||
}
|
||||
if pattern.MatchString(command) {
|
||||
return CommandLevelReject
|
||||
}
|
||||
}
|
||||
return CommandLevelNormal
|
||||
}
|
169
backend/pkg/proto/ssh/api/auth.go
Normal file
169
backend/pkg/proto/ssh/api/auth.go
Normal file
@@ -0,0 +1,169 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-resty/resty/v2"
|
||||
|
||||
"github.com/veops/oneterm/pkg/server/auth/acl"
|
||||
"github.com/veops/oneterm/pkg/server/controller"
|
||||
"github.com/veops/oneterm/pkg/server/model"
|
||||
"github.com/veops/oneterm/pkg/util"
|
||||
)
|
||||
|
||||
type Auth struct {
|
||||
Username string
|
||||
Password string
|
||||
PublicKey string
|
||||
|
||||
Api string
|
||||
XToken string
|
||||
SecretKey string
|
||||
}
|
||||
|
||||
func NewAuthServer(username, password, publicKey, Api, token, secretKey string) *Auth {
|
||||
return &Auth{
|
||||
Username: username,
|
||||
Password: password,
|
||||
PublicKey: publicKey,
|
||||
|
||||
Api: Api,
|
||||
XToken: token,
|
||||
SecretKey: secretKey,
|
||||
}
|
||||
}
|
||||
|
||||
func (a *Auth) Authenticate() (token string, err error) {
|
||||
client := resty.New()
|
||||
var (
|
||||
method int8
|
||||
data *controller.HttpResponse
|
||||
)
|
||||
if a.Password != "" {
|
||||
method = 1
|
||||
} else if a.PublicKey != "" {
|
||||
method = 2
|
||||
} else {
|
||||
return "", fmt.Errorf("no password or publicKey")
|
||||
}
|
||||
|
||||
resp, err := client.R().
|
||||
SetHeader("X-Token", a.XToken).
|
||||
SetHeader("Content-Type", "application/json").
|
||||
SetBody(map[string]interface{}{
|
||||
"method": method,
|
||||
"password": a.Password,
|
||||
"pk": a.PublicKey,
|
||||
"username": a.Username,
|
||||
}).
|
||||
SetResult(&data).
|
||||
Post(strings.TrimSuffix(a.Api, "/") + authUrl)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("api request error:%v", err.Error())
|
||||
}
|
||||
if resp.StatusCode() != 200 {
|
||||
return "", fmt.Errorf("%s", string(resp.Body()))
|
||||
}
|
||||
if data.Code != 0 {
|
||||
return "", fmt.Errorf(data.Message)
|
||||
}
|
||||
return data.Data.(map[string]any)["cookie"].(string), nil
|
||||
}
|
||||
|
||||
func (a *Auth) AccountInfo(token string, uid int, name string) (account *model.Account, err error) {
|
||||
data := map[string]string{"info": "true"}
|
||||
if uid > 0 {
|
||||
data["id"] = fmt.Sprintf("%d", uid)
|
||||
}
|
||||
if name != "" {
|
||||
data["name"] = name
|
||||
}
|
||||
res, err := request(resty.MethodGet,
|
||||
fmt.Sprintf("%s%s", strings.TrimSuffix(a.Api, "/"), accountUrl),
|
||||
map[string]string{
|
||||
"Cookie": token,
|
||||
"X-Token": a.XToken,
|
||||
}, data, nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if res.Count == 0 {
|
||||
err = fmt.Errorf("no account found for %v", uid)
|
||||
return
|
||||
}
|
||||
err = util.DecodeStruct(&account, res.List[0])
|
||||
return
|
||||
}
|
||||
|
||||
func (a *Auth) Accounts(token string) (account []*model.Account, err error) {
|
||||
res, err := request(resty.MethodGet,
|
||||
fmt.Sprintf("%s%s", strings.TrimSuffix(a.Api, "/"), accountUrl),
|
||||
map[string]string{
|
||||
"Cookie": token,
|
||||
"X-Token": a.XToken,
|
||||
}, map[string]string{"info": "true"}, nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if res.Count == 0 {
|
||||
err = fmt.Errorf("no account found")
|
||||
return
|
||||
}
|
||||
err = util.DecodeStruct(&account, res.List)
|
||||
return
|
||||
}
|
||||
|
||||
func request(method, path string, headers map[string]string, param map[string]string,
|
||||
body any) (res *controller.ListData, err error) {
|
||||
client := resty.New().SetTimeout(time.Second * 15).R()
|
||||
if param != nil {
|
||||
client = client.SetQueryParams(param)
|
||||
}
|
||||
for k, v := range headers {
|
||||
client = client.SetHeader(k, v)
|
||||
}
|
||||
if body != nil {
|
||||
client = client.SetBody(body)
|
||||
}
|
||||
var response *controller.HttpResponse
|
||||
client = client.SetResult(&response)
|
||||
r, err := client.Execute(method, path)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("api request error:%v", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if r.StatusCode() != 200 {
|
||||
err = fmt.Errorf("auth code: %d: %s", r.StatusCode(), r.String())
|
||||
return
|
||||
}
|
||||
if response.Code != 0 {
|
||||
err = fmt.Errorf(response.Message)
|
||||
return
|
||||
}
|
||||
err = util.DecodeStruct(&res, response.Data)
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (a *Auth) AclInfo(sess string) (aclInfo *acl.Acl, er error) {
|
||||
session := acl.Session{}
|
||||
for _, v := range strings.Split(sess, ";") {
|
||||
if strings.HasPrefix(strings.TrimSpace(v), "session=") {
|
||||
sess = strings.TrimPrefix(strings.TrimSpace(v), "session=")
|
||||
}
|
||||
}
|
||||
s := acl.NewSignature(a.SecretKey, "cookie-session", "", "hmac", nil, nil)
|
||||
content, err := s.Unsign(sess)
|
||||
if err != nil {
|
||||
er = err
|
||||
return
|
||||
}
|
||||
err = json.Unmarshal(content, &session)
|
||||
if err != nil {
|
||||
return aclInfo, err
|
||||
}
|
||||
return &session.Acl, nil
|
||||
}
|
20
backend/pkg/proto/ssh/api/onterm.go
Normal file
20
backend/pkg/proto/ssh/api/onterm.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
gossh "github.com/gliderlabs/ssh"
|
||||
)
|
||||
|
||||
type CoreInstance struct {
|
||||
Auth *Auth
|
||||
Asset *AssetCore
|
||||
Session *gossh.Session
|
||||
Audit *AuditCore
|
||||
}
|
||||
|
||||
func NewCoreInstance(apiHost, token, secretKey string) *CoreInstance {
|
||||
coreInstance := &CoreInstance{
|
||||
Auth: NewAuthServer("", "", "", apiHost, token, secretKey),
|
||||
Asset: NewAssetServer(apiHost, token),
|
||||
}
|
||||
return coreInstance
|
||||
}
|
23
backend/pkg/proto/ssh/api/var.go
Normal file
23
backend/pkg/proto/ssh/api/var.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package api
|
||||
|
||||
const (
|
||||
// auth
|
||||
authUrl = "/public_key/auth"
|
||||
|
||||
// asset
|
||||
assetUrl = "/asset"
|
||||
gatewayUrl = "/gateway"
|
||||
commandUrl = "/command"
|
||||
configUrl = "/config"
|
||||
assetTotalUrl = "/asset/query_by_server"
|
||||
assetUpdateState = "/asset/update_by_server"
|
||||
|
||||
// account
|
||||
accountUrl = "/account"
|
||||
|
||||
// audit
|
||||
sessionUrl = "/session"
|
||||
replayUrl = "/session/replay"
|
||||
replayFileUrl = "/session/replay"
|
||||
sessionCmdUrl = "/session/cmd"
|
||||
)
|
67
backend/pkg/proto/ssh/client/parse.go
Normal file
67
backend/pkg/proto/ssh/client/parse.go
Normal file
@@ -0,0 +1,67 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type Parser struct {
|
||||
lock sync.Mutex
|
||||
vimState bool
|
||||
commandState bool
|
||||
}
|
||||
|
||||
var (
|
||||
enterMarks = [][]byte{
|
||||
[]byte("\x1b[?1049h"),
|
||||
[]byte("\x1b[?1048h"),
|
||||
[]byte("\x1b[?1047h"),
|
||||
[]byte("\x1b[?47h"),
|
||||
}
|
||||
|
||||
exitMarks = [][]byte{
|
||||
[]byte("\x1b[?1049l"),
|
||||
[]byte("\x1b[?1048l"),
|
||||
[]byte("\x1b[?1047l"),
|
||||
[]byte("\x1b[?47l"),
|
||||
}
|
||||
screenMarks = [][]byte{
|
||||
{0x1b, 0x5b, 0x4b, 0x0d, 0x0a},
|
||||
{0x1b, 0x5b, 0x34, 0x6c},
|
||||
}
|
||||
)
|
||||
|
||||
func (p *Parser) State(b []byte) bool {
|
||||
if !p.vimState && IsEditEnterMode(b) {
|
||||
if !isNewScreen(b) {
|
||||
p.vimState = true
|
||||
p.commandState = false
|
||||
}
|
||||
}
|
||||
if p.vimState && IsEditExitMode(b) {
|
||||
p.vimState = false
|
||||
p.commandState = true
|
||||
}
|
||||
return p.vimState
|
||||
}
|
||||
|
||||
func isNewScreen(p []byte) bool {
|
||||
return matchMark(p, screenMarks)
|
||||
}
|
||||
|
||||
func IsEditEnterMode(p []byte) bool {
|
||||
return matchMark(p, enterMarks)
|
||||
}
|
||||
|
||||
func IsEditExitMode(p []byte) bool {
|
||||
return matchMark(p, exitMarks)
|
||||
}
|
||||
|
||||
func matchMark(p []byte, marks [][]byte) bool {
|
||||
for _, item := range marks {
|
||||
if bytes.Contains(p, item) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
341
backend/pkg/proto/ssh/client/ssh.go
Normal file
341
backend/pkg/proto/ssh/client/ssh.go
Normal file
@@ -0,0 +1,341 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
gossh "github.com/gliderlabs/ssh"
|
||||
"github.com/google/uuid"
|
||||
gssh "golang.org/x/crypto/ssh"
|
||||
|
||||
"github.com/veops/oneterm/pkg/logger"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/record"
|
||||
"github.com/veops/oneterm/pkg/server/model"
|
||||
)
|
||||
|
||||
type Connection struct {
|
||||
Session *gssh.Session
|
||||
Stdin io.Writer
|
||||
Stdout io.Reader
|
||||
|
||||
SessionId string
|
||||
Record record.Record
|
||||
Commands []byte
|
||||
AssetId int
|
||||
AccountId int
|
||||
Gateway *model.Gateway
|
||||
|
||||
Parser *Parser
|
||||
|
||||
GateWayCloseChan chan struct{}
|
||||
Exit chan struct{}
|
||||
}
|
||||
|
||||
type GatewayClient struct {
|
||||
client *gssh.Client
|
||||
targetAddr string
|
||||
}
|
||||
|
||||
var (
|
||||
GatewayListener net.Listener
|
||||
GatewayConnections sync.Map
|
||||
)
|
||||
|
||||
func NewSSHClientConfig(user string, account *model.Account) (*gssh.ClientConfig, error) {
|
||||
am, er := authMethod(account)
|
||||
if er != nil {
|
||||
return nil, er
|
||||
}
|
||||
sshConfig := &gssh.ClientConfig{
|
||||
Timeout: time.Second * 5,
|
||||
User: user,
|
||||
Auth: []gssh.AuthMethod{
|
||||
am,
|
||||
},
|
||||
HostKeyCallback: gssh.InsecureIgnoreHostKey(), // 不验证服务器的HostKey
|
||||
}
|
||||
return sshConfig, nil
|
||||
}
|
||||
|
||||
func authMethod(account *model.Account) (gssh.AuthMethod, error) {
|
||||
switch account.AccountType {
|
||||
case model.AUTHMETHOD_PASSWORD:
|
||||
return gssh.Password(account.Password), nil
|
||||
case model.AUTHMETHOD_PUBLICKEY:
|
||||
if account.Phrase == "" {
|
||||
pk, err := gssh.ParsePrivateKey([]byte(account.Pk))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gssh.PublicKeys(pk), nil
|
||||
} else {
|
||||
pk, err := gssh.ParsePrivateKeyWithPassphrase([]byte(account.Pk), []byte(account.Phrase))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return gssh.PublicKeys(pk), nil
|
||||
}
|
||||
default:
|
||||
return nil, fmt.Errorf("invalid authmethod %d", account.AccountType)
|
||||
}
|
||||
}
|
||||
|
||||
// publicKeyBytes
|
||||
// path: ~/.ssh/id_ed25519
|
||||
//func publicKeyBytes(path string) error {
|
||||
// pbk, err := os.ReadFile(path)
|
||||
// publicKey, err := gossh.ParsePublicKey(pbk)
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// gossh.PublicKeyAuth(func(ctx gossh.Context, key gossh.PublicKey) bool {
|
||||
// return gossh.KeysEqual(key, publicKey)
|
||||
// })
|
||||
// return nil
|
||||
//}
|
||||
|
||||
func NewSShSession(con *gssh.Client, pty gossh.Pty, gatewayCloseChan chan struct{}) (conn *Connection, err error) {
|
||||
sess, er := con.NewSession()
|
||||
if er != nil {
|
||||
err = er
|
||||
return
|
||||
}
|
||||
modes := gssh.TerminalModes{
|
||||
gssh.ECHO: 1,
|
||||
gssh.TTY_OP_ISPEED: 14400,
|
||||
gssh.TTY_OP_OSPEED: 14400,
|
||||
}
|
||||
if err = sess.RequestPty("xterm", pty.Window.Height, pty.Window.Width, modes); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
stdin, err := sess.StdinPipe()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
stdout, err := sess.StdoutPipe()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if err := sess.Shell(); err != nil {
|
||||
_ = sess.Close()
|
||||
}
|
||||
conn = &Connection{
|
||||
Stdin: stdin,
|
||||
Stdout: stdout,
|
||||
Session: sess,
|
||||
SessionId: uuid.NewString(),
|
||||
GateWayCloseChan: gatewayCloseChan,
|
||||
Exit: make(chan struct{}),
|
||||
}
|
||||
|
||||
conn.Record, err = record.NewAsciinema(conn.SessionId, pty)
|
||||
conn.Parser = &Parser{
|
||||
vimState: false,
|
||||
commandState: true,
|
||||
lock: sync.Mutex{},
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// NewSShClient1
|
||||
// =====================================================do not edit=============================================
|
||||
func NewSShClient(addr string, account *model.Account, gateway *model.Gateway) (cli *gssh.Client, gatewayCloseChan chan struct{}, err error) {
|
||||
sshConf, err := NewSSHClientConfig(account.Account, account)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
tmp := strings.Split(strings.TrimSpace(addr), ":")
|
||||
if len(tmp) != 2 {
|
||||
tmp = append(tmp, "22")
|
||||
}
|
||||
addr = strings.Join(tmp, ":")
|
||||
|
||||
if gateway != nil {
|
||||
gatewayCloseChan = make(chan struct{})
|
||||
gatewayConf, er := NewSSHClientConfig(gateway.Account,
|
||||
&model.Account{AccountType: gateway.AccountType, Account: gateway.Account,
|
||||
Password: gateway.Password, Pk: gateway.Pk, Phrase: gateway.Phrase})
|
||||
if er != nil {
|
||||
err = fmt.Errorf("gateway is not available %w", er)
|
||||
return
|
||||
}
|
||||
gatewayCli, er := gssh.Dial("tcp", fmt.Sprintf("%s:%d", gateway.Host, gateway.Port), gatewayConf)
|
||||
if er != nil {
|
||||
err = fmt.Errorf("gateway is not available %w", er)
|
||||
return
|
||||
}
|
||||
|
||||
//hostname, er := os.Hostname()
|
||||
//if er != nil {
|
||||
// err = fmt.Errorf("gateway is not available %w", er)
|
||||
// return
|
||||
//}
|
||||
targetAddr := addr
|
||||
//addr = fmt.Sprintf("%s:%d", hostname, port)
|
||||
port, er := GetAvailablePort()
|
||||
addr = fmt.Sprintf("127.0.0.1:%d", port)
|
||||
listener, er := net.Listen("tcp", addr)
|
||||
if er != nil {
|
||||
err = fmt.Errorf("gateway is not available %w", er)
|
||||
return
|
||||
}
|
||||
|
||||
var accept bool
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-gatewayCloseChan:
|
||||
return
|
||||
default:
|
||||
if accept {
|
||||
continue
|
||||
}
|
||||
lc, err := listener.Accept()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
gatewayConn, err := gatewayCli.Dial("tcp", targetAddr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
go func() {
|
||||
_, _ = io.Copy(lc, gatewayConn)
|
||||
}()
|
||||
go func() {
|
||||
_, _ = io.Copy(gatewayConn, lc)
|
||||
}()
|
||||
accept = true
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
cli, err = gssh.Dial("tcp", addr, sshConf)
|
||||
return
|
||||
}
|
||||
|
||||
func ResizeSshClient(sess *gssh.Session, h, w int) {
|
||||
err := sess.WindowChange(h, w)
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
func GetAvailablePort() (int, error) {
|
||||
addr, err := net.ResolveTCPAddr("tcp", "localhost:0")
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
l, err := net.ListenTCP("tcp", addr)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
defer func(l *net.TCPListener) {
|
||||
_ = l.Close()
|
||||
}(l)
|
||||
return l.Addr().(*net.TCPAddr).Port, nil
|
||||
}
|
||||
|
||||
func AcquireGatewayListener() (string, error) {
|
||||
if GatewayListener == nil {
|
||||
port, err := GetAvailablePort()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("get available port failed:%s", err.Error())
|
||||
}
|
||||
addr := fmt.Sprintf("127.0.0.1:%d", port)
|
||||
listener, er := net.Listen("tcp", addr)
|
||||
if er != nil {
|
||||
return "", fmt.Errorf("listen tcp %s failed: %s", addr, er.Error())
|
||||
}
|
||||
GatewayListener = listener
|
||||
ListenGateway()
|
||||
}
|
||||
return GatewayListener.Addr().String(), nil
|
||||
}
|
||||
|
||||
// func NewSShClient1(addr string, account *model.Account, gateway *model.Gateway) (cli *gssh.Client, gatewayCloseChan chan struct{}, err error) {
|
||||
// password, pubkey := account.Password, ""
|
||||
// if account.AccountType == model.AUTHMETHOD_PUBLICKEY {
|
||||
// password, pubkey = pubkey, password
|
||||
// }
|
||||
// sshConf, err := NewSSHClientConfig(account.Account, password, pubkey)
|
||||
// if err != nil {
|
||||
// return
|
||||
// }
|
||||
|
||||
// tmp := strings.Split(strings.TrimSpace(addr), ":")
|
||||
// if len(tmp) != 2 {
|
||||
// tmp = append(tmp, "22")
|
||||
// }
|
||||
// addr = strings.Join(tmp, ":")
|
||||
|
||||
// if gateway != nil {
|
||||
// gatewayCloseChan = make(chan struct{})
|
||||
// gatewayConf, er := NewSSHClientConfig(gateway.Account, gateway.Password, "")
|
||||
// if er != nil {
|
||||
// err = fmt.Errorf("gateway is not available %w", er)
|
||||
// return
|
||||
// }
|
||||
|
||||
// gatewayCli, er := gssh.Dial("tcp", fmt.Sprintf("%s:%d", gateway.Host, gateway.Port), gatewayConf)
|
||||
// if er != nil {
|
||||
// err = fmt.Errorf("gateway is not available %w", er)
|
||||
// return
|
||||
// }
|
||||
|
||||
// if gatewayAddr, er := AcquireGatewayListener(); er != nil {
|
||||
// err = er
|
||||
// return
|
||||
// } else {
|
||||
// fmt.Println("dial.........", gatewayAddr, sshConf)
|
||||
// //c, er := net.DialTimeout("tcp", gatewayAddr, time.Second*5)
|
||||
// //fmt.Println(c, er)
|
||||
// cli, err = gssh.Dial("tcp", gatewayAddr, sshConf)
|
||||
// if err != nil {
|
||||
// return
|
||||
// }
|
||||
// fmt.Println("store.......")
|
||||
// GatewayConnections.Store(cli.LocalAddr().String(), GatewayClient{client: gatewayCli, targetAddr: addr})
|
||||
// fmt.Println("endd dial...", err)
|
||||
// }
|
||||
|
||||
// } else {
|
||||
// cli, err = gssh.Dial("tcp", addr, sshConf)
|
||||
// }
|
||||
// return
|
||||
// }
|
||||
|
||||
func ListenGateway() {
|
||||
|
||||
go func() {
|
||||
for {
|
||||
conn, err := GatewayListener.Accept()
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error())
|
||||
return
|
||||
}
|
||||
if v, ok := GatewayConnections.Load(conn.RemoteAddr().String()); ok {
|
||||
cli := v.(GatewayClient)
|
||||
gatewayConn, err := cli.client.Dial("tcp", cli.targetAddr)
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error())
|
||||
break
|
||||
}
|
||||
go func() {
|
||||
_, _ = io.Copy(conn, gatewayConn)
|
||||
}()
|
||||
go func() {
|
||||
_, _ = io.Copy(gatewayConn, conn)
|
||||
}()
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
28
backend/pkg/proto/ssh/config/config.go
Normal file
28
backend/pkg/proto/ssh/config/config.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Api string `yaml:"api"`
|
||||
Token string `yaml:"token"`
|
||||
|
||||
Ip string `yaml:"ip"`
|
||||
Port int `yaml:"port"`
|
||||
|
||||
WebUser string `yaml:"webUser"`
|
||||
WebToken string `yaml:"webToken"`
|
||||
|
||||
RecordFilePath string `yaml:"recordFilePath"`
|
||||
PrivateKeyPath string `yaml:"privateKeyPath"`
|
||||
|
||||
PlainMode bool `yaml:"plainMode"`
|
||||
}
|
||||
|
||||
var (
|
||||
SSHConfig Config
|
||||
TotalMonitors = sync.Map{}
|
||||
TotalHostSession = sync.Map{}
|
||||
Assets = sync.Map{}
|
||||
)
|
126
backend/pkg/proto/ssh/handler/handlers.go
Normal file
126
backend/pkg/proto/ssh/handler/handlers.go
Normal file
@@ -0,0 +1,126 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
gossh "github.com/gliderlabs/ssh"
|
||||
gssh "golang.org/x/crypto/ssh"
|
||||
|
||||
"github.com/veops/oneterm/pkg/logger"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/api"
|
||||
cfg "github.com/veops/oneterm/pkg/proto/ssh/config"
|
||||
"github.com/veops/oneterm/pkg/server/model"
|
||||
)
|
||||
|
||||
type sshdServer struct {
|
||||
Core *api.CoreInstance
|
||||
}
|
||||
|
||||
func Init(address, apiHost, token, privateKeyPath, secretKey string) (*gossh.Server, error) {
|
||||
sshd := NewSshdServer(apiHost, token, secretKey)
|
||||
s := &gossh.Server{
|
||||
Addr: address,
|
||||
Handler: sshd.HomeHandler,
|
||||
PasswordHandler: sshd.PasswordHandler,
|
||||
PublicKeyHandler: sshd.PublicKeyHandler,
|
||||
IdleTimeout: time.Hour*2 + time.Minute,
|
||||
}
|
||||
|
||||
for _, v := range hostPrivateKeys(privateKeyPath) {
|
||||
singer, er := gssh.ParsePrivateKey(v)
|
||||
if er != nil {
|
||||
continue
|
||||
}
|
||||
s.AddHostKey(singer)
|
||||
}
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func hostPrivateKeys(privateKeyPath string) [][]byte {
|
||||
var res [][]byte
|
||||
|
||||
if privateKeyPath == "" {
|
||||
homeDir, er := os.UserHomeDir()
|
||||
if er != nil {
|
||||
logger.L.Error(er.Error())
|
||||
}
|
||||
privateKeyPath = homeDir + "/.ssh/id_ed25519"
|
||||
}
|
||||
privateKey, err := os.ReadFile(privateKeyPath)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
return res
|
||||
}
|
||||
return [][]byte{privateKey}
|
||||
}
|
||||
|
||||
func NewSshdServer(apiHost, token, secretKey string) *sshdServer {
|
||||
s := &sshdServer{
|
||||
Core: api.NewCoreInstance(apiHost, token, secretKey),
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *sshdServer) PasswordHandler(ctx gossh.Context, password string) bool {
|
||||
if password == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
if ctx.User() == cfg.SSHConfig.WebUser && password == cfg.SSHConfig.WebToken {
|
||||
ctx.SetValue("sshType", model.SESSIONTYPE_WEB)
|
||||
return true
|
||||
}
|
||||
ctx.SetValue("sshType", model.SESSIONTYPE_CLIENT)
|
||||
s.Core.Auth.Username = ctx.User()
|
||||
s.Core.Auth.Password = password
|
||||
s.Core.Auth.PublicKey = ""
|
||||
return s.Auth(ctx)
|
||||
}
|
||||
|
||||
func (s *sshdServer) PublicKeyHandler(ctx gossh.Context, key gossh.PublicKey) bool {
|
||||
authorizedKey := gssh.MarshalAuthorizedKey(key)
|
||||
s.Core.Auth.PublicKey = strings.TrimSpace(string(authorizedKey))
|
||||
if s.Core.Auth.PublicKey == "" {
|
||||
return false
|
||||
}
|
||||
s.Core.Auth.Username = ctx.User()
|
||||
s.Core.Auth.Password = ""
|
||||
if ctx.Value("sshType") == nil {
|
||||
ctx.SetValue("sshType", model.SESSIONTYPE_CLIENT)
|
||||
}
|
||||
return s.Auth(ctx)
|
||||
}
|
||||
|
||||
func (s *sshdServer) Auth(ctx gossh.Context) bool {
|
||||
cookie, err := s.Core.Auth.Authenticate()
|
||||
if err != nil || cookie == "" {
|
||||
return false
|
||||
}
|
||||
|
||||
ctx.SetValue("cookie", cookie)
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *sshdServer) HomeHandler(gs gossh.Session) {
|
||||
|
||||
if py, winChan, isPty := gs.Pty(); isPty {
|
||||
if py.Window.Height == 0 {
|
||||
py.Window.Height = 24
|
||||
}
|
||||
interactiveSrv := NewInteractiveHandler(gs, s, py)
|
||||
go interactiveSrv.WatchWinSize(winChan)
|
||||
interactiveSrv.Schedule(&py)
|
||||
} else {
|
||||
if _, err := io.WriteString(gs, "不是PTY请求.\n"); err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
err := gs.Exit(1)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
795
backend/pkg/proto/ssh/handler/interactive.go
Normal file
795
backend/pkg/proto/ssh/handler/interactive.go
Normal file
@@ -0,0 +1,795 @@
|
||||
// Package handler
|
||||
/**
|
||||
Copyright (c) The Authors.
|
||||
* @Author: feng.xiang
|
||||
* @Date: 2023/12/13 09:50
|
||||
* @Desc:
|
||||
*/
|
||||
package handler
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/BurntSushi/toml"
|
||||
"github.com/c-bata/go-prompt"
|
||||
"github.com/chzyer/readline"
|
||||
gossh "github.com/gliderlabs/ssh"
|
||||
"github.com/mattn/go-runewidth"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"github.com/olekukonko/tablewriter"
|
||||
"github.com/patrickmn/go-cache"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/veops/go-ansiterm"
|
||||
"go.uber.org/zap"
|
||||
"golang.org/x/crypto/ssh"
|
||||
"golang.org/x/text/language"
|
||||
|
||||
myi18n "github.com/veops/oneterm/pkg/i18n"
|
||||
"github.com/veops/oneterm/pkg/logger"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/client"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/config"
|
||||
"github.com/veops/oneterm/pkg/server/model"
|
||||
"github.com/veops/oneterm/pkg/util"
|
||||
)
|
||||
|
||||
type InteractiveHandler struct {
|
||||
Locker *sync.RWMutex
|
||||
|
||||
Session gossh.Session
|
||||
//Term *term.Terminal
|
||||
Term *readline.Instance
|
||||
Prompt *prompt.Prompt
|
||||
Localizer *i18n.Localizer
|
||||
SshType int
|
||||
pty *gossh.Pty
|
||||
|
||||
Sshd *sshdServer
|
||||
Pty gossh.Pty
|
||||
Language int
|
||||
|
||||
Assets []*model.Asset
|
||||
Accounts map[int]*model.Account
|
||||
Commands map[int]*model.Command
|
||||
HistoryInput []string
|
||||
|
||||
SshClient *ssh.Client
|
||||
SshSession map[string]*client.Connection
|
||||
GatewayCloseChan chan struct{}
|
||||
|
||||
SelectedAsset *model.Asset
|
||||
SessionReq *model.SshReq
|
||||
|
||||
AccountInfo *model.Account
|
||||
NeedAccount bool
|
||||
|
||||
Parser *Parser
|
||||
|
||||
GatewayListener net.Listener
|
||||
MessageChan chan string
|
||||
AccountsForSelect []*model.Account
|
||||
Cache *cache.Cache
|
||||
}
|
||||
|
||||
type Parser struct {
|
||||
Input *ansiterm.ByteStream
|
||||
Output *ansiterm.ByteStream
|
||||
InputData []byte
|
||||
OutputData []byte
|
||||
Ps1 string
|
||||
Ps2 string
|
||||
}
|
||||
|
||||
var (
|
||||
Bundle = i18n.NewBundle(language.Chinese)
|
||||
TotalSession = map[string]*client.Connection{}
|
||||
)
|
||||
|
||||
func I18nInit(path string) {
|
||||
Bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal)
|
||||
files, err := util.ListFiles(path)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error(), zap.String("module", "i18n"))
|
||||
}
|
||||
for _, f := range files {
|
||||
_, err = Bundle.LoadMessageFile(f)
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error(), zap.String("module", "i18n"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func NewInteractiveHandler(s gossh.Session, ss *sshdServer, pty gossh.Pty) *InteractiveHandler {
|
||||
//t := term.NewTerminal(s, "> ")
|
||||
|
||||
t, err := readline.NewEx(&readline.Config{
|
||||
Stdin: s,
|
||||
Stdout: s,
|
||||
Prompt: ">",
|
||||
})
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
|
||||
ih := &InteractiveHandler{
|
||||
Locker: new(sync.RWMutex),
|
||||
Term: t,
|
||||
Session: s,
|
||||
Sshd: ss,
|
||||
|
||||
SessionReq: &model.SshReq{},
|
||||
SshSession: map[string]*client.Connection{},
|
||||
Pty: pty,
|
||||
MessageChan: make(chan string, 128),
|
||||
Cache: cache.New(time.Minute, time.Minute*5),
|
||||
}
|
||||
ih.Language = 1
|
||||
ih.Localizer = i18n.NewLocalizer(Bundle)
|
||||
width := 120
|
||||
height := 40
|
||||
if pty.Window.Width != 0 {
|
||||
width = pty.Window.Width
|
||||
}
|
||||
if pty.Window.Height != 0 {
|
||||
height = pty.Window.Height
|
||||
}
|
||||
ih.Parser = &Parser{
|
||||
Input: NewParser(width, height),
|
||||
Output: NewParser(width, height),
|
||||
}
|
||||
|
||||
return ih
|
||||
}
|
||||
|
||||
func completer(d prompt.Document) []prompt.Suggest {
|
||||
// 这里可以根据用户的实时输入来动态生成建议
|
||||
suggestions := []prompt.Suggest{
|
||||
{Text: "users", Description: "Store the username"},
|
||||
{Text: "articles", Description: "Store the article text posted by user"},
|
||||
}
|
||||
|
||||
// 只有当用户输入为空,或者以 'u' 开始时,才显示建议
|
||||
if d.TextBeforeCursor() == "" || d.GetWordBeforeCursorWithSpace() == "u" {
|
||||
return prompt.FilterHasPrefix(suggestions, d.GetWordBeforeCursor(), true)
|
||||
}
|
||||
|
||||
// 其他情况不显示任何建议
|
||||
return []prompt.Suggest{}
|
||||
}
|
||||
|
||||
func NewParser(width, height int) *ansiterm.ByteStream {
|
||||
screen := ansiterm.NewScreen(width, height)
|
||||
stream := ansiterm.InitByteStream(screen, false)
|
||||
stream.Attach(screen)
|
||||
return stream
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) WatchWinSize(winChan <-chan gossh.Window) {
|
||||
for {
|
||||
select {
|
||||
case <-i.Session.Context().Done():
|
||||
return
|
||||
case win, ok := <-winChan:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
for _, v := range i.SshSession {
|
||||
client.ResizeSshClient(v.Session, win.Height, win.Width)
|
||||
_ = v.Record.Resize(win.Height, win.Width)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) SwitchLanguage(lang string) {
|
||||
languages := []string{"zh", "en"}
|
||||
|
||||
switch len(lang) {
|
||||
case 0:
|
||||
length := len(languages)
|
||||
if length <= 1 {
|
||||
return
|
||||
}
|
||||
if i.Language >= length {
|
||||
i.Language = 1
|
||||
} else {
|
||||
i.Language += 1
|
||||
}
|
||||
default:
|
||||
for index, v := range languages {
|
||||
if v == lang {
|
||||
i.Language = index + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
i.Localizer = i18n.NewLocalizer(Bundle, languages[i.Language-1])
|
||||
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) SwitchLang(lang string) {
|
||||
languages := []string{"zh", "en"}
|
||||
|
||||
switch len(lang) {
|
||||
case 0:
|
||||
length := len(languages)
|
||||
if length <= 1 {
|
||||
return
|
||||
}
|
||||
if i.Language >= length {
|
||||
i.Language = 1
|
||||
} else {
|
||||
i.Language += 1
|
||||
}
|
||||
default:
|
||||
for index, v := range languages {
|
||||
if v == lang {
|
||||
i.Language = index + 1
|
||||
}
|
||||
}
|
||||
}
|
||||
i.Localizer = i18n.NewLocalizer(Bundle, languages[i.Language-1])
|
||||
i.PrintMessage(myi18n.MsgSshWelcome, map[string]any{"User": i.Session.User()})
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) output(msg string) {
|
||||
_, _ = io.WriteString(i.Session, msg)
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) HostInfo(id int) (asset *model.Asset, err error) {
|
||||
if id < 0 {
|
||||
return
|
||||
}
|
||||
|
||||
cookie, ok := i.Session.Context().Value("cookie").(string)
|
||||
if !ok {
|
||||
err = fmt.Errorf("no cookie")
|
||||
return
|
||||
}
|
||||
res, er := i.Sshd.Core.Asset.Lists(cookie, "", id)
|
||||
if er != nil {
|
||||
err = er
|
||||
return
|
||||
}
|
||||
if res.Count != 1 {
|
||||
er = fmt.Errorf("found %d hosts: not unique", res.Count)
|
||||
return
|
||||
}
|
||||
bs, er := json.Marshal(res.List[0])
|
||||
if er != nil {
|
||||
err = er
|
||||
return
|
||||
}
|
||||
err = json.Unmarshal(bs, &asset)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
return asset, nil
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) Check(id int, host *model.Asset) (asset *model.Asset, state bool, err error) {
|
||||
assets, er := i.AcquireAssets("", id)
|
||||
if er != nil {
|
||||
err = err
|
||||
return
|
||||
}
|
||||
if len(assets) == 0 {
|
||||
return
|
||||
}
|
||||
asset = assets[0]
|
||||
state = i.Sshd.Core.Asset.HasPermission(asset.AccessAuth)
|
||||
return
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) generateSessionRecord(conn *client.Connection, status int) (res *model.Session, err error) {
|
||||
res = &model.Session{
|
||||
SessionType: cast.ToInt(i.Session.Context().Value("sshType")),
|
||||
}
|
||||
if i.SessionReq != nil && i.SessionReq.SessionId != "" {
|
||||
err = util.DecodeStruct(&res, i.SessionReq)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
res.Uid = i.SessionReq.Uid
|
||||
} else {
|
||||
res.ClientIp = i.Session.RemoteAddr().String()
|
||||
res.UserName = i.Session.Context().User()
|
||||
res.AccountInfo = fmt.Sprintf("%s(%s)", i.AccountInfo.Name, i.AccountInfo.Account)
|
||||
res.Protocol = i.SessionReq.Protocol
|
||||
|
||||
}
|
||||
s, er := i.Sshd.Core.Auth.AclInfo(i.Session.Context().Value("cookie").(string))
|
||||
if er != nil {
|
||||
logger.L.Warn(er.Error(), zap.String("session", "add"))
|
||||
} else if s != nil {
|
||||
res.Uid = s.Uid
|
||||
res.UserName = s.UserName
|
||||
}
|
||||
res.Status = status
|
||||
res.AssetInfo = fmt.Sprintf("%s(%s)", i.SelectedAsset.Name, i.SelectedAsset.Ip)
|
||||
res.SessionId = conn.SessionId
|
||||
res.GatewayId = i.SelectedAsset.GatewayId
|
||||
if conn.Gateway != nil {
|
||||
res.GatewayInfo = fmt.Sprintf("%s:%d", conn.Gateway.Host, conn.Gateway.Port)
|
||||
}
|
||||
res.AssetId = i.SelectedAsset.Id
|
||||
res.AccountId = i.AccountInfo.Id
|
||||
if status == model.SESSIONSTATUS_OFFLINE {
|
||||
t := time.Now()
|
||||
res.ClosedAt = &t
|
||||
}
|
||||
return
|
||||
}
|
||||
func readLine(s gossh.Session) string {
|
||||
buf := make([]byte, 1)
|
||||
var in []byte
|
||||
for {
|
||||
_, _ = s.Read(buf)
|
||||
switch buf[0] {
|
||||
case []byte("\r")[0], []byte("\r\n")[0]:
|
||||
return string(in)
|
||||
default:
|
||||
in = append(in, buf[0])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) Schedule(pty *gossh.Pty) {
|
||||
i.pty = pty
|
||||
var err error
|
||||
var line string
|
||||
if st, ok := i.Session.Context().Value("sshType").(int); ok && st == model.SESSIONTYPE_WEB {
|
||||
//line, err = i.Term.ReadLine()
|
||||
line = readLine(i.Session)
|
||||
if err != nil {
|
||||
logger.L.Debug("connection closed", zap.String("msg", err.Error()))
|
||||
return
|
||||
}
|
||||
var r *model.SshReq
|
||||
err = json.Unmarshal([]byte(line), &r)
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error())
|
||||
return
|
||||
}
|
||||
// "Accept-Language")
|
||||
//i.Localizer = i18n.NewLocalizer(conf.Bundle, lang, accept)
|
||||
i.Session.Context().SetValue("cookie", r.Cookie)
|
||||
i.SessionReq = r
|
||||
|
||||
// monitor
|
||||
{
|
||||
if i.SessionReq.SessionId != "" {
|
||||
switch i.SessionReq.Action {
|
||||
case model.SESSIONACTION_MONITOR:
|
||||
i.wrapJsonResponse(i.SessionReq.SessionId, 0, "success")
|
||||
RegisterMonitorSession(i.SessionReq.SessionId, i.Session)
|
||||
return
|
||||
case model.SESSIONACTION_CLOSE:
|
||||
if v, ok := config.TotalHostSession.Load(i.SessionReq.SessionId); ok {
|
||||
err = v.(*client.Connection).Session.Close()
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error())
|
||||
i.wrapJsonResponse(i.SessionReq.SessionId, 1, "failed")
|
||||
return
|
||||
}
|
||||
close(v.(*client.Connection).Exit)
|
||||
}
|
||||
i.wrapJsonResponse(i.SessionReq.SessionId, 0, "success")
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
host, ok, err := i.Check(r.AssetId, nil)
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error())
|
||||
i.wrapJsonResponse("", 1, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if !ok {
|
||||
i.wrapJsonResponse("", 1, fmt.Sprintf("invalid status for %v", r.AssetId))
|
||||
return
|
||||
}
|
||||
i.SelectedAsset = host
|
||||
|
||||
commands, er := i.AcquireCommands()
|
||||
if er != nil {
|
||||
return
|
||||
}
|
||||
i.Commands = commands
|
||||
_, err = i.Proxy(host.Ip, r.AccountId)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error(), zap.String("module", "proxy"))
|
||||
}
|
||||
return
|
||||
} else {
|
||||
if config.SSHConfig.PlainMode {
|
||||
i.SwitchLang("zh")
|
||||
for {
|
||||
//line, err = i.Term.ReadLine()
|
||||
line, err = i.Term.Readline()
|
||||
|
||||
if err != nil {
|
||||
logger.L.Debug("connection closed", zap.String("msg", err.Error()))
|
||||
break
|
||||
}
|
||||
if strings.TrimSpace(line) == "" {
|
||||
continue
|
||||
}
|
||||
if i.HandleInput(strings.TrimSpace(line)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tm := InitAndRunTerm(i)
|
||||
_, err := tm.Run()
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error(), zap.String("module", "schedule"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) HandleInput(line string) (exit bool) {
|
||||
|
||||
switch strings.TrimSpace(line) {
|
||||
case "/*":
|
||||
i.SelectedAsset = nil
|
||||
assets, er := i.AcquireAssets("", 0)
|
||||
if er != nil {
|
||||
return
|
||||
}
|
||||
accounts, er := i.AcquireAccounts()
|
||||
if er != nil {
|
||||
return
|
||||
}
|
||||
commands, er := i.AcquireCommands()
|
||||
if er != nil {
|
||||
return
|
||||
}
|
||||
i.Locker.Lock()
|
||||
i.Assets = assets
|
||||
i.Accounts = accounts
|
||||
i.Commands = commands
|
||||
i.Locker.Unlock()
|
||||
|
||||
i.showResult(assets)
|
||||
return
|
||||
case "/?", "/?":
|
||||
i.PrintMessage(myi18n.MsgSshWelcome, map[string]any{"User": i.Session.User()})
|
||||
return
|
||||
case "/s":
|
||||
i.SwitchLang("")
|
||||
return
|
||||
case "/q":
|
||||
i.Session.Close()
|
||||
return
|
||||
default:
|
||||
switch {
|
||||
case line == "exit":
|
||||
logger.L.Info("exit", zap.String("user", i.Session.User()), zap.String("input", line))
|
||||
i.Session.Close()
|
||||
return
|
||||
}
|
||||
}
|
||||
_, er := i.Proxy(line, -1)
|
||||
if er != nil {
|
||||
logger.L.Info(er.Error())
|
||||
}
|
||||
if st, ok := i.Session.Context().Value("sshType").(int); ok && st == model.SESSIONTYPE_WEB {
|
||||
exit = true
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) AcquireAndStoreAssets(search string, id int) (selectedHosts, likeHosts []*model.Asset, err error) {
|
||||
i.Locker.RLock()
|
||||
count := len(i.Assets)
|
||||
i.Locker.RUnlock()
|
||||
var find = func(assets []*model.Asset) (selectedHosts, likeHosts []*model.Asset) {
|
||||
if search == "" {
|
||||
return
|
||||
}
|
||||
for _, v := range assets {
|
||||
if v.Ip == search || v.Name == search {
|
||||
selectedHosts = append(selectedHosts, v)
|
||||
} else if strings.Contains(v.Ip, search) || strings.Contains(v.Name, search) {
|
||||
likeHosts = append(likeHosts, v)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
if count == 0 {
|
||||
res, er := i.AcquireAssets(search, id)
|
||||
if er != nil {
|
||||
err = er
|
||||
return
|
||||
}
|
||||
selectedHosts, likeHosts = find(res)
|
||||
i.Locker.Lock()
|
||||
i.Assets = res
|
||||
i.Locker.Unlock()
|
||||
return
|
||||
} else {
|
||||
i.Locker.Lock()
|
||||
selectedHosts, likeHosts = find(i.Assets)
|
||||
i.Locker.Unlock()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) AcquireAssets(search string, id int) (assets []*model.Asset, err error) {
|
||||
if search == "" && id <= 0 {
|
||||
if v, ok := i.Cache.Get("assets"); ok {
|
||||
return v.([]*model.Asset), nil
|
||||
} else {
|
||||
defer func() {
|
||||
if err == nil {
|
||||
i.Cache.Set("assets", assets, 0)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
if totalAssets, ok := i.Cache.Get("assets"); ok {
|
||||
for _, v := range totalAssets.([]*model.Asset) {
|
||||
if id > 0 {
|
||||
if id == v.Id {
|
||||
assets = append(assets, v)
|
||||
return
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
if strings.Contains(v.Name, search) {
|
||||
assets = append(assets, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cookie, ok := i.Session.Context().Value("cookie").(string)
|
||||
if ok {
|
||||
res, er := i.Sshd.Core.Asset.Lists(cookie, search, id)
|
||||
if er != nil {
|
||||
err = er
|
||||
return
|
||||
}
|
||||
if res != nil {
|
||||
for _, v := range res.List {
|
||||
var v1 model.Asset
|
||||
_ = util.DecodeStruct(&v1, v)
|
||||
bs, _ := json.Marshal(v.(map[string]interface{})["authorization"])
|
||||
er = json.Unmarshal(bs, &v1.Authorization)
|
||||
if er != nil {
|
||||
logger.L.Warn(er.Error())
|
||||
}
|
||||
assets = append(assets, &v1)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err = fmt.Errorf("no cookies")
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) AcquireAccounts() (accounts map[int]*model.Account, err error) {
|
||||
accounts = map[int]*model.Account{}
|
||||
cookie, ok := i.Session.Context().Value("cookie").(string)
|
||||
if ok {
|
||||
res, er := i.Sshd.Core.Auth.Accounts(cookie)
|
||||
if er != nil {
|
||||
err = er
|
||||
return
|
||||
}
|
||||
for _, v := range res {
|
||||
var v1 model.Account
|
||||
_ = util.DecodeStruct(&v1, v)
|
||||
accounts[v1.Id] = &v1
|
||||
}
|
||||
} else {
|
||||
err = fmt.Errorf("no cookies")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) AcquireAccountInfo(id int, name string) (res *model.Account, err error) {
|
||||
cookie, ok := i.Session.Context().Value("cookie").(string)
|
||||
if ok {
|
||||
return i.Sshd.Core.Auth.AccountInfo(cookie, id, name)
|
||||
} else {
|
||||
err = fmt.Errorf("no cookies")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) AcquireCommands() (commands map[int]*model.Command, err error) {
|
||||
commands = map[int]*model.Command{}
|
||||
cookie, ok := i.Session.Context().Value("cookie").(string)
|
||||
if ok {
|
||||
res, er := i.Sshd.Core.Asset.Commands(cookie)
|
||||
if er != nil {
|
||||
err = er
|
||||
return
|
||||
}
|
||||
for _, v := range res {
|
||||
var v1 model.Command
|
||||
_ = util.DecodeStruct(&v1, v)
|
||||
commands[v1.Id] = &v1
|
||||
}
|
||||
} else {
|
||||
err = fmt.Errorf("no cookies")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) AcquireConfig() (config *model.Config, err error) {
|
||||
config = &model.Config{}
|
||||
cookie, ok := i.Session.Context().Value("cookie").(string)
|
||||
if ok {
|
||||
res, er := i.Sshd.Core.Asset.Config(cookie)
|
||||
if er != nil {
|
||||
err = er
|
||||
return
|
||||
}
|
||||
config = res
|
||||
} else {
|
||||
err = fmt.Errorf("no cookies")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) showResult(data []*model.Asset) {
|
||||
i.Term.SetPrompt("host> ")
|
||||
var hosts []string
|
||||
for _, d := range data {
|
||||
hosts = append(hosts, d.Name)
|
||||
}
|
||||
|
||||
var templateData = map[string]interface{}{
|
||||
"Count": len(data),
|
||||
"Msg": "",
|
||||
}
|
||||
|
||||
if data != nil {
|
||||
templateData["Msg"] = i.tableData(hosts)
|
||||
}
|
||||
i.PrintMessage(myi18n.MsgSshShowAssetResults, templateData)
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) tableData(data []string) string {
|
||||
chunkData := i.chunkData(data)
|
||||
buf := &bytes.Buffer{}
|
||||
tw := tablewriter.NewWriter(buf)
|
||||
tw.SetAutoWrapText(false)
|
||||
tw.SetColumnSeparator(" ")
|
||||
tw.SetNoWhiteSpace(false)
|
||||
tw.SetBorder(false)
|
||||
tw.SetAlignment(tablewriter.ALIGN_LEFT)
|
||||
tw.AppendBulk(chunkData)
|
||||
tw.Render()
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) chunkData(data []string) (res [][]string) {
|
||||
width := 80
|
||||
if i.pty != nil {
|
||||
width = i.pty.Window.Width
|
||||
}
|
||||
n := len(data)
|
||||
chunk := n
|
||||
for ; chunk >= 1; chunk -= 1 {
|
||||
ok := true
|
||||
for i := 0; i < n && ok; i += chunk {
|
||||
w := chunk*3 + 4
|
||||
r := i + chunk
|
||||
if r > n {
|
||||
r = n
|
||||
}
|
||||
for _, s := range data[i:r] {
|
||||
w += runewidth.StringWidth(s)
|
||||
}
|
||||
ok = ok && w <= width
|
||||
}
|
||||
if ok {
|
||||
t := i.getChunk(data, chunk)
|
||||
maxLen := make(map[int]int)
|
||||
for _, c := range t {
|
||||
for i, v := range c {
|
||||
l := runewidth.StringWidth(v)
|
||||
if l > maxLen[i] {
|
||||
maxLen[i] = l
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, row := range t {
|
||||
w := chunk*3 + 4
|
||||
for i := range row {
|
||||
w += maxLen[i]
|
||||
}
|
||||
ok = ok && w <= width
|
||||
}
|
||||
|
||||
}
|
||||
if ok {
|
||||
break
|
||||
}
|
||||
}
|
||||
if chunk < 1 {
|
||||
chunk = 1
|
||||
}
|
||||
res = i.getChunk(data, chunk)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) getChunk(data []string, chunk int) (res [][]string) {
|
||||
n := len(data)
|
||||
for i := 0; i < n; i += chunk {
|
||||
r := i + chunk
|
||||
if r > n {
|
||||
r = n
|
||||
}
|
||||
res = append(res, data[i:r])
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) wrapJsonResponse(sessionId string, code int, message string) {
|
||||
if st, ok := i.Session.Context().Value("sshType").(int); ok && st != model.SESSIONTYPE_WEB {
|
||||
return
|
||||
}
|
||||
res, er := json.Marshal(model.SshResp{
|
||||
Code: code,
|
||||
Message: message,
|
||||
SessionId: sessionId,
|
||||
Uid: i.SessionReq.Uid,
|
||||
UserName: i.SessionReq.UserName,
|
||||
})
|
||||
|
||||
if er != nil {
|
||||
logger.L.Error(er.Error())
|
||||
}
|
||||
i.output(string(append(res, []byte("\r")...)))
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) NewSession(account *model.Account, gateway *model.Gateway) (conn *client.Connection, err error) {
|
||||
i.Locker.Lock()
|
||||
defer i.Locker.Unlock()
|
||||
if i.SshClient == nil {
|
||||
con, ch, er := client.NewSShClient(strings.ReplaceAll(i.SessionReq.Protocol, "ssh", i.SelectedAsset.Ip), account, gateway)
|
||||
if er != nil {
|
||||
err = er
|
||||
return
|
||||
}
|
||||
i.SshClient = con
|
||||
i.GatewayCloseChan = ch
|
||||
}
|
||||
i.AccountInfo = account
|
||||
|
||||
conn, err = client.NewSShSession(i.SshClient, i.Pty, i.GatewayCloseChan)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
conn.AssetId = i.SelectedAsset.Id
|
||||
conn.AccountId = account.Id
|
||||
conn.Gateway = gateway
|
||||
i.SshSession[conn.SessionId] = conn
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) UpsertSession(conn *client.Connection, status int) error {
|
||||
resp, err := i.generateSessionRecord(conn, status)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return i.Sshd.Core.Audit.NewSession(resp)
|
||||
}
|
34
backend/pkg/proto/ssh/handler/message.go
Normal file
34
backend/pkg/proto/ssh/handler/message.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/veops/oneterm/pkg/logger"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/config"
|
||||
)
|
||||
|
||||
func (i *InteractiveHandler) PrintMessage(msg *i18n.Message, data any) {
|
||||
if config.SSHConfig.PlainMode {
|
||||
i.output("\r\n" + i.Message(msg, data))
|
||||
} else {
|
||||
i.MessageChan <- i.Message(msg, data)
|
||||
}
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) PrintMessageV1(msg *i18n.Message, data any) {
|
||||
i.output(i.Message(msg, data))
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) Message(msg *i18n.Message, data any) string {
|
||||
str, er := i.Localizer.Localize(&i18n.LocalizeConfig{
|
||||
DefaultMessage: msg,
|
||||
TemplateData: data,
|
||||
PluralCount: 1,
|
||||
})
|
||||
if er != nil {
|
||||
logger.L.Warn(er.Error(), zap.String("module", "i18n"))
|
||||
return ""
|
||||
}
|
||||
return str
|
||||
}
|
539
backend/pkg/proto/ssh/handler/proxy.go
Normal file
539
backend/pkg/proto/ssh/handler/proxy.go
Normal file
@@ -0,0 +1,539 @@
|
||||
// Package handler
|
||||
/**
|
||||
Copyright (c) The Authors.
|
||||
* @Author: feng.xiang
|
||||
* @Date: 2024/1/18 17:05
|
||||
* @Desc:
|
||||
*/
|
||||
package handler
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
gossh "github.com/gliderlabs/ssh"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
|
||||
myi18n "github.com/veops/oneterm/pkg/i18n"
|
||||
"github.com/veops/oneterm/pkg/logger"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/client"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/config"
|
||||
"github.com/veops/oneterm/pkg/server/model"
|
||||
)
|
||||
|
||||
func (i *InteractiveHandler) Proxy(line string, accountId int) (step int, err error) {
|
||||
step = 1
|
||||
if accountId > 0 {
|
||||
var accountName string
|
||||
defer func() {
|
||||
if err != nil {
|
||||
i.PrintMessage(myi18n.MsgSshAccountLoginError, map[string]any{"User": accountName})
|
||||
}
|
||||
}()
|
||||
if i.SelectedAsset != nil && accountId < 0 {
|
||||
accountName = line
|
||||
}
|
||||
host, ok, er := i.Check(i.SelectedAsset.Id, nil)
|
||||
if er != nil {
|
||||
err = er
|
||||
return
|
||||
}
|
||||
if !ok {
|
||||
err = fmt.Errorf("current time is not allowed to access")
|
||||
return
|
||||
}
|
||||
i.SelectedAsset = host
|
||||
if _, ok := i.SelectedAsset.Authorization[accountId]; !ok {
|
||||
err = fmt.Errorf("you donnot have permission")
|
||||
return
|
||||
}
|
||||
account, er := i.Sshd.Core.Auth.AccountInfo(i.Session.Context().Value("cookie").(string), accountId, accountName)
|
||||
if er != nil {
|
||||
err = er
|
||||
return
|
||||
}
|
||||
accountName = account.Name
|
||||
var gateway *model.Gateway
|
||||
if i.SelectedAsset.GatewayId != 0 {
|
||||
gateway, err = i.Sshd.Core.Asset.Gateway(i.Session.Context().Value("cookie").(string), i.SelectedAsset.GatewayId)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
conn, er := i.NewSession(account, gateway)
|
||||
if er != nil {
|
||||
err = er
|
||||
return
|
||||
}
|
||||
er = i.UpsertSession(conn, model.SESSIONSTATUS_ONLINE)
|
||||
if er != nil {
|
||||
logger.L.Warn(er.Error())
|
||||
}
|
||||
config.TotalHostSession.Store(conn.SessionId, conn)
|
||||
|
||||
if err := i.bind(i.Session, conn); err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
step = 1
|
||||
} else {
|
||||
if i.NeedAccount && i.SelectedAsset != nil {
|
||||
i.NeedAccount = false
|
||||
var account *model.Account
|
||||
accountIds := make([]int, 0)
|
||||
for aId := range i.SelectedAsset.Authorization {
|
||||
accountIds = append(accountIds, aId)
|
||||
}
|
||||
sort.Ints(accountIds)
|
||||
for _, aId := range accountIds {
|
||||
account := i.Accounts[aId]
|
||||
if config.SSHConfig.PlainMode {
|
||||
if account == nil || !strings.Contains(account.Name, line) {
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
if account == nil || line != account.Name {
|
||||
continue
|
||||
}
|
||||
}
|
||||
return i.Proxy(line, account.Id)
|
||||
}
|
||||
if account == nil {
|
||||
i.PrintMessage(myi18n.MsgSshAccountLoginError, map[string]any{"User": line})
|
||||
}
|
||||
return
|
||||
} else if strings.TrimSpace(line) == "" {
|
||||
return
|
||||
}
|
||||
var (
|
||||
host *model.Asset
|
||||
)
|
||||
selectHosts, likeHosts, er := i.AcquireAndStoreAssets(line, 0)
|
||||
if er != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
if len(selectHosts) == 0 && len(likeHosts) == 0 {
|
||||
i.PrintMessage(myi18n.MsgSshNoMatchingAsset, map[string]any{"Host": line})
|
||||
return
|
||||
}
|
||||
|
||||
switch len(selectHosts) {
|
||||
case 0:
|
||||
switch len(likeHosts) {
|
||||
case 0:
|
||||
return
|
||||
case 1:
|
||||
host = likeHosts[0]
|
||||
default:
|
||||
i.showResult(likeHosts)
|
||||
return
|
||||
}
|
||||
case 1:
|
||||
host = selectHosts[0]
|
||||
default:
|
||||
i.showResult(selectHosts)
|
||||
return
|
||||
}
|
||||
i.SelectedAsset = host
|
||||
|
||||
var sshPort string
|
||||
for _, v := range host.Protocols {
|
||||
tmp := strings.Split(v, ":")
|
||||
if len(tmp) == 2 && tmp[0] == "ssh" {
|
||||
sshPort = tmp[1]
|
||||
}
|
||||
}
|
||||
if sshPort == "" {
|
||||
i.PrintMessage(myi18n.MsgSshNoSshAccessMethod, map[string]any{"Host": line})
|
||||
return
|
||||
}
|
||||
i.SessionReq.Protocol = "ssh:" + sshPort
|
||||
|
||||
var hostAccountIds []int
|
||||
if len(i.Accounts) == 0 {
|
||||
accounts, er := i.AcquireAccounts()
|
||||
if er != nil {
|
||||
logger.L.Info(er.Error())
|
||||
} else {
|
||||
i.Accounts = accounts
|
||||
}
|
||||
}
|
||||
for k := range host.Authorization {
|
||||
if v, ok := i.Accounts[k]; ok {
|
||||
hostAccountIds = append(hostAccountIds, v.Id)
|
||||
}
|
||||
}
|
||||
sort.Ints(hostAccountIds)
|
||||
switch len(hostAccountIds) {
|
||||
case 0:
|
||||
i.PrintMessage(myi18n.MsgSshNoSshAccountForAsset, map[string]any{"Host": line})
|
||||
return
|
||||
case 1:
|
||||
return i.Proxy(line, hostAccountIds[0])
|
||||
default:
|
||||
var accounts []string
|
||||
for _, aId := range hostAccountIds {
|
||||
if account, ok := i.Accounts[aId]; ok {
|
||||
i.AccountsForSelect = append(i.AccountsForSelect, account)
|
||||
accounts = append(accounts, account.Name)
|
||||
}
|
||||
}
|
||||
i.NeedAccount = true
|
||||
if config.SSHConfig.PlainMode {
|
||||
i.PrintMessage(myi18n.MsgSshMultiSshAccountForAsset, map[string]any{"Accounts": i.tableData(accounts)})
|
||||
}
|
||||
step = 2
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) bind(userConn gossh.Session, hostConn *client.Connection) error {
|
||||
maxIdelTimeout := time.Hour * 2
|
||||
idleTimeout := time.Second * 60 * 5
|
||||
mConfig, _ := i.AcquireConfig()
|
||||
if mConfig != nil && mConfig.Timeout > 0 {
|
||||
idleTimeout = time.Second * time.Duration(mConfig.Timeout)
|
||||
}
|
||||
if idleTimeout > maxIdelTimeout {
|
||||
idleTimeout = maxIdelTimeout
|
||||
}
|
||||
|
||||
targetInChan := make(chan []byte, 1)
|
||||
targetOutChan := make(chan []byte, 1)
|
||||
done := make(chan struct{})
|
||||
var (
|
||||
exit bool
|
||||
accessUpdateStep = time.Minute
|
||||
waitRead atomic.Bool
|
||||
)
|
||||
waitRead.Store(true)
|
||||
i.wrapJsonResponse(hostConn.SessionId, 0, "success")
|
||||
tk, tkAccess, readReset := time.NewTicker(idleTimeout), time.NewTicker(accessUpdateStep), time.NewTicker(time.Second)
|
||||
go func() {
|
||||
buffer := bytes.NewBuffer(make([]byte, 0, 1024*2))
|
||||
maxLen := 1024
|
||||
for {
|
||||
if !waitRead.Load() {
|
||||
if exit {
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
continue
|
||||
}
|
||||
|
||||
buf := make([]byte, maxLen)
|
||||
nr, err := userConn.Read(buf)
|
||||
waitRead.Store(config.SSHConfig.PlainMode)
|
||||
if err != nil {
|
||||
logger.L.Info(err.Error())
|
||||
}
|
||||
|
||||
if nr > 0 {
|
||||
validBytes := buf[:nr]
|
||||
bufferLen := buffer.Len()
|
||||
if bufferLen > 0 || nr == maxLen {
|
||||
buffer.Write(buf[:nr])
|
||||
validBytes = validBytes[:0]
|
||||
}
|
||||
remainBytes := buffer.Bytes()
|
||||
for len(remainBytes) > 0 {
|
||||
r, size := utf8.DecodeRune(remainBytes)
|
||||
if r == utf8.RuneError {
|
||||
if len(remainBytes) <= 3 {
|
||||
break
|
||||
}
|
||||
}
|
||||
validBytes = append(validBytes, remainBytes[:size]...)
|
||||
remainBytes = remainBytes[size:]
|
||||
}
|
||||
buffer.Reset()
|
||||
if len(remainBytes) > 0 {
|
||||
buffer.Write(remainBytes)
|
||||
}
|
||||
select {
|
||||
case targetInChan <- validBytes:
|
||||
case <-done:
|
||||
break
|
||||
}
|
||||
}
|
||||
if exit {
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
close(targetInChan)
|
||||
}()
|
||||
go func() {
|
||||
defer func() {
|
||||
waitRead.Store(config.SSHConfig.PlainMode)
|
||||
}()
|
||||
for {
|
||||
buf := make([]byte, 1024)
|
||||
n, err := hostConn.Stdout.Read(buf)
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
close(done)
|
||||
exit = true
|
||||
} else {
|
||||
logger.L.Warn(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
if exit {
|
||||
waitRead.Store(config.SSHConfig.PlainMode)
|
||||
} else {
|
||||
waitRead.Store(true)
|
||||
}
|
||||
|
||||
select {
|
||||
case targetOutChan <- buf[:n]:
|
||||
case <-done:
|
||||
break
|
||||
}
|
||||
if exit || err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
}()
|
||||
defer func() {
|
||||
exit = true
|
||||
|
||||
waitRead.Store(config.SSHConfig.PlainMode)
|
||||
}()
|
||||
for {
|
||||
select {
|
||||
case p, ok := <-targetOutChan:
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
_, err := userConn.Write(p)
|
||||
if err != nil {
|
||||
logger.L.Info(err.Error())
|
||||
}
|
||||
|
||||
err = i.HandleData("output", p, hostConn, targetOutChan)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
tk.Reset(idleTimeout)
|
||||
case p, ok := <-targetInChan:
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
tk.Reset(idleTimeout)
|
||||
//readL.WriteStdin(p)
|
||||
err := i.HandleData("input", p, hostConn, targetOutChan)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
readReset.Reset(time.Second)
|
||||
case <-done:
|
||||
break
|
||||
case <-tk.C:
|
||||
_, err := userConn.Write([]byte(i.Message(myi18n.MsgSShHostIdleTimeout, map[string]any{"Idle": idleTimeout})))
|
||||
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error())
|
||||
}
|
||||
exit = true
|
||||
case <-readReset.C:
|
||||
waitRead.Store(true)
|
||||
case <-hostConn.Exit:
|
||||
exit = true
|
||||
case <-i.Session.Context().Done():
|
||||
exit = true
|
||||
case <-tkAccess.C:
|
||||
commands, er := i.AcquireCommands()
|
||||
if er == nil {
|
||||
i.Commands = commands
|
||||
}
|
||||
asset, er := i.AcquireAssets("", hostConn.AssetId)
|
||||
if er != nil || len(asset) <= 0 || !i.Sshd.Core.Asset.HasPermission(asset[0].AccessAuth) {
|
||||
_, err := userConn.Write([]byte(i.Message(myi18n.MsgSshAccessRefusedInTimespan, nil)))
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
exit = true
|
||||
break
|
||||
}
|
||||
i.SelectedAsset = asset[0]
|
||||
if _, ok := asset[0].Authorization[hostConn.AccountId]; !ok {
|
||||
_, err := userConn.Write([]byte(i.Message(myi18n.MsgSshNoAssetPermission, map[string]any{"Host": i.SelectedAsset.Name})))
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error())
|
||||
}
|
||||
exit = true
|
||||
break
|
||||
}
|
||||
account, er := i.AcquireAccountInfo(hostConn.AccountId, "")
|
||||
if er != nil || account == nil {
|
||||
_, err := userConn.Write([]byte(i.Message(myi18n.MsgSshNoAssetPermission, map[string]any{"Host": i.SelectedAsset.Name})))
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error())
|
||||
}
|
||||
exit = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if exit {
|
||||
i.Exits(hostConn)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) CommandLevel(cmd string) int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func parseOutput(data []string) (output []string) {
|
||||
for _, line := range data {
|
||||
if strings.TrimSpace(line) != "" {
|
||||
output = append(output, line)
|
||||
}
|
||||
}
|
||||
return output
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) Output() string {
|
||||
i.Parser.Output.Feed(i.Parser.OutputData)
|
||||
|
||||
res := parseOutput(i.Parser.Output.Listener.Display())
|
||||
if len(res) == 0 {
|
||||
return ""
|
||||
}
|
||||
return res[len(res)-1]
|
||||
}
|
||||
func (i *InteractiveHandler) Command() string {
|
||||
s := i.Output()
|
||||
return strings.TrimSpace(strings.TrimPrefix(strings.TrimSpace(s), strings.TrimSpace(i.Parser.Ps1)))
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) HandleData(src string, data []byte, hostConn *client.Connection,
|
||||
targetOutputChan chan<- []byte) (err error) {
|
||||
switch src {
|
||||
case "input": // input from user
|
||||
if hostConn.Parser.State(data) {
|
||||
_, err = hostConn.Stdin.Write(data)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
var write bool
|
||||
if bytes.LastIndex(data, []byte{13}) != 0 {
|
||||
_, err = hostConn.Stdin.Write(data)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
write = true
|
||||
}
|
||||
if len(i.Parser.InputData) == 0 && i.Parser.Ps2 == "" {
|
||||
i.Parser.Ps1 = i.Output()
|
||||
}
|
||||
i.Parser.InputData = append(i.Parser.InputData, data...)
|
||||
if bytes.LastIndex(data, []byte{13}) == 0 {
|
||||
command := i.Command()
|
||||
i.Parser.Output.Listener.Reset()
|
||||
i.Parser.OutputData = nil
|
||||
i.Parser.InputData = nil
|
||||
if _, valid := i.CommandCheck(command); valid {
|
||||
if strings.TrimSpace(command) != "" {
|
||||
go i.Sshd.Core.Audit.AddCommand(model.SessionCmd{Cmd: command, Level: i.CommandLevel(command), SessionId: hostConn.SessionId})
|
||||
}
|
||||
if !write {
|
||||
_, err = hostConn.Stdin.Write(data)
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tips, _ := i.Localizer.Localize(&i18n.LocalizeConfig{
|
||||
DefaultMessage: myi18n.MsgSshCommandRefused,
|
||||
TemplateData: map[string]string{"Command": command},
|
||||
PluralCount: 1,
|
||||
})
|
||||
i.Parser.Ps2 = i.Parser.Ps1 + command
|
||||
targetOutputChan <- []byte("\r\n" + tips + i.Parser.Ps2)
|
||||
break
|
||||
}
|
||||
}
|
||||
case "output": // output from target
|
||||
if !hostConn.Parser.State(data) {
|
||||
i.Parser.OutputData = append(i.Parser.OutputData, data...)
|
||||
}
|
||||
err = hostConn.Record.Write(data)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
Monitor(hostConn.SessionId, data)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) Exits(conn *client.Connection) {
|
||||
if conn.GateWayCloseChan != nil {
|
||||
conn.GateWayCloseChan <- struct{}{}
|
||||
}
|
||||
_ = conn.Session.Close()
|
||||
conn.Record.Close()
|
||||
|
||||
config.TotalHostSession.Delete(conn.SessionId)
|
||||
config.TotalMonitors.Delete(conn.SessionId)
|
||||
|
||||
i.Locker.Lock()
|
||||
delete(i.SshSession, conn.SessionId)
|
||||
if len(i.SshSession) == 0 {
|
||||
_ = i.SshClient.Close()
|
||||
i.SshClient = nil
|
||||
}
|
||||
i.Locker.Unlock()
|
||||
err := i.UpsertSession(conn, model.SESSIONSTATUS_OFFLINE)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func (i *InteractiveHandler) CommandCheck(command string) (string, bool) {
|
||||
for _, id := range i.SelectedAsset.CmdIds {
|
||||
cmd, ok := i.Commands[id]
|
||||
if !ok || !cmd.Enable {
|
||||
continue
|
||||
}
|
||||
for _, c := range cmd.Cmds {
|
||||
p, err := regexp.Compile(c)
|
||||
if err == nil {
|
||||
if p.Match([]byte(command)) {
|
||||
return c, false
|
||||
}
|
||||
} else {
|
||||
if c == command {
|
||||
return c, false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", true
|
||||
}
|
||||
|
||||
//func (v *VirtualTermIn) Read(p []byte) (n int, err error) {
|
||||
// return v.InChan.Read(p)
|
||||
//}
|
||||
//
|
||||
//func (v *VirtualTermIn) Close() error {
|
||||
// return nil
|
||||
//}
|
||||
//
|
||||
//func (v *VirtualTermOut) Write(p []byte) (n int, err error) {
|
||||
// return v.OutChan.Write(p)
|
||||
//}
|
47
backend/pkg/proto/ssh/handler/sider.go
Normal file
47
backend/pkg/proto/ssh/handler/sider.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
gossh "github.com/gliderlabs/ssh"
|
||||
|
||||
"github.com/veops/oneterm/pkg/logger"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/config"
|
||||
)
|
||||
|
||||
func RegisterMonitorSession(sessionId string, sess gossh.Session) {
|
||||
_, ok := config.TotalHostSession.Load(sessionId)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
config.TotalMonitors.LoadOrStore(sessionId, sess)
|
||||
|
||||
if _, ok := config.TotalMonitors.Load(sessionId); !ok {
|
||||
config.TotalMonitors.Store(sessionId, sess)
|
||||
}
|
||||
|
||||
<-sess.Context().Done()
|
||||
DeleteMonitorSession(sessionId)
|
||||
}
|
||||
|
||||
func DeleteMonitorSession(sessionId string) {
|
||||
config.TotalMonitors.Delete(sessionId)
|
||||
}
|
||||
|
||||
func getMonitorSession(sessionId string) gossh.Session {
|
||||
if v, ok := config.TotalMonitors.Load(sessionId); ok {
|
||||
return v.(gossh.Session)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func Monitor(sessionId string, p []byte) {
|
||||
if s := getMonitorSession(sessionId); s != nil {
|
||||
_, err := s.Write(p)
|
||||
if err != nil {
|
||||
logger.L.Error(fmt.Sprintf("moninor session %s failed: %s", sessionId, err.Error()))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
380
backend/pkg/proto/ssh/handler/term.go
Normal file
380
backend/pkg/proto/ssh/handler/term.go
Normal file
@@ -0,0 +1,380 @@
|
||||
// Package handler
|
||||
/**
|
||||
Copyright (c) The Authors.
|
||||
* @Author: feng.xiang
|
||||
* @Date: 2024/1/24 15:20
|
||||
* @Desc:
|
||||
*/
|
||||
package handler
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/charmbracelet/bubbles/table"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"go.uber.org/zap"
|
||||
|
||||
myi18n "github.com/veops/oneterm/pkg/i18n"
|
||||
"github.com/veops/oneterm/pkg/logger"
|
||||
)
|
||||
|
||||
type TermModel struct {
|
||||
table table.Model
|
||||
query string
|
||||
cookie string
|
||||
Object *InteractiveHandler
|
||||
SearchTime time.Time
|
||||
Rows []table.Row
|
||||
Step int
|
||||
PreView int
|
||||
lang string
|
||||
lastOutputLines int
|
||||
in *ProxyReader
|
||||
out *ProxyWriter
|
||||
hostExit bool
|
||||
hasMsg chan struct{}
|
||||
}
|
||||
|
||||
const (
|
||||
Tip int = iota
|
||||
ChooseHost
|
||||
ChooseAccount
|
||||
HostInteractive
|
||||
)
|
||||
|
||||
var baseStyle = lipgloss.NewStyle().
|
||||
BorderStyle(lipgloss.NormalBorder()).
|
||||
BorderForeground(lipgloss.Color("240"))
|
||||
|
||||
func (m *TermModel) Init() tea.Cmd { return nil }
|
||||
|
||||
func (m *TermModel) addStep(v int) {
|
||||
switch m.Step {
|
||||
case Tip, ChooseHost:
|
||||
m.Step += v
|
||||
case ChooseAccount:
|
||||
m.Step -= v
|
||||
default:
|
||||
m.Step = Tip
|
||||
}
|
||||
}
|
||||
|
||||
func (m *TermModel) printfToSSH(out string) tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
_, err := m.Object.Session.Write([]byte(out + "\n"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (m *TermModel) CurrentState() int {
|
||||
return Tip
|
||||
}
|
||||
|
||||
func (m *TermModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
var (
|
||||
cmd tea.Cmd
|
||||
err error
|
||||
)
|
||||
switch msg := msg.(type) {
|
||||
case tea.KeyMsg:
|
||||
switch msg.String() {
|
||||
case "esc":
|
||||
if m.table.Focused() {
|
||||
m.table.Blur()
|
||||
} else {
|
||||
m.table.Focus()
|
||||
}
|
||||
case "ctrl+c":
|
||||
return m, tea.Quit
|
||||
case "enter":
|
||||
sr := m.table.SelectedRow()
|
||||
if len(sr) == 0 {
|
||||
break
|
||||
}
|
||||
s := m.query
|
||||
m.query = ""
|
||||
switch s {
|
||||
case "/?":
|
||||
m.Step = Tip
|
||||
return m, nil
|
||||
default:
|
||||
switch len(sr) {
|
||||
case 0:
|
||||
return m, nil
|
||||
default:
|
||||
m.ClearDataSource()
|
||||
m.Step, err = m.Object.Proxy(sr[1], 0)
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error())
|
||||
}
|
||||
m.ResetSource()
|
||||
|
||||
m.convertRows()
|
||||
m.updateTable()
|
||||
|
||||
if len(m.Object.MessageChan) > 0 {
|
||||
out := <-m.Object.MessageChan
|
||||
return m, tea.Batch(tea.ClearScreen, tea.Printf(out))
|
||||
}
|
||||
|
||||
if len(m.Object.AccountsForSelect) > 0 {
|
||||
m.Object.AccountsForSelect = nil
|
||||
}
|
||||
|
||||
return m, tea.ClearScreen
|
||||
}
|
||||
}
|
||||
case "backspace":
|
||||
if len(m.query) > 0 {
|
||||
m.query = m.query[:len(m.query)-1]
|
||||
}
|
||||
m.updateTable()
|
||||
default:
|
||||
if msg.Type == tea.KeyRunes && len(msg.String()) >= 1 {
|
||||
m.query += msg.String()
|
||||
}
|
||||
switch m.query {
|
||||
case "/?":
|
||||
m.Step = Tip
|
||||
m.query = ""
|
||||
return m, nil
|
||||
case "/s":
|
||||
m.Step = Tip
|
||||
m.query = ""
|
||||
m.Object.SwitchLanguage("")
|
||||
return m, nil
|
||||
case "/q":
|
||||
return m, tea.Quit
|
||||
case "/*":
|
||||
m.Step = Tip
|
||||
m.query = ""
|
||||
}
|
||||
if m.Step == Tip {
|
||||
m.Step = ChooseHost
|
||||
}
|
||||
m.updateTable()
|
||||
}
|
||||
|
||||
}
|
||||
m.table, cmd = m.table.Update(msg)
|
||||
return m, cmd
|
||||
}
|
||||
|
||||
//func (m *TermModel) Welcome() []table.Row {
|
||||
// rows := []table.Row{
|
||||
// {"/?", "help"},
|
||||
// {"/s", "swith"},
|
||||
// }
|
||||
//}
|
||||
|
||||
func (m *TermModel) View() string {
|
||||
defer func() {
|
||||
m.in.hasMsg.Store(false)
|
||||
}()
|
||||
|
||||
var s string
|
||||
switch m.Step {
|
||||
case Tip:
|
||||
//m.table.SetColumns([]table.Column{
|
||||
//{Title: "Tip", Width: 80},
|
||||
//})
|
||||
m.PreView = Tip
|
||||
s += m.Object.Message(myi18n.MsgSshWelcome, map[string]any{"User": m.Object.Session.User()})
|
||||
s = "\x1b[2K\x1b[G" + s + "\n: " + m.query
|
||||
case ChooseHost:
|
||||
m.table.SetColumns([]table.Column{
|
||||
{Title: "No.", Width: 5},
|
||||
{Title: "Name", Width: 20},
|
||||
{Title: "Ip", Width: 18},
|
||||
})
|
||||
|
||||
if m.PreView == Tip {
|
||||
s = "\x1b[2K\x1b[G"
|
||||
}
|
||||
s += baseStyle.Render(m.table.View() + "\n: " + m.query)
|
||||
case ChooseAccount:
|
||||
m.table.SetColumns([]table.Column{
|
||||
{Title: "No.", Width: 5},
|
||||
{Title: "Name", Width: 20},
|
||||
{Title: "Account", Width: 18},
|
||||
})
|
||||
s += baseStyle.Render(m.table.View() + "\n: " + m.query)
|
||||
}
|
||||
return s
|
||||
//m.lastOutputLines = strings.Count(s, "\n") + 1
|
||||
//moveToBottomRight := "\033[999;999H"
|
||||
//moveToBottomRight = ""
|
||||
//return moveToBottomRight + s
|
||||
}
|
||||
|
||||
func (m *TermModel) clearLastOutput() string {
|
||||
return fmt.Sprintf("\033[%dA\033[J", m.lastOutputLines)
|
||||
}
|
||||
|
||||
func (m *TermModel) updateTable() {
|
||||
if m.query == "" {
|
||||
m.table.SetRows(m.Rows)
|
||||
return
|
||||
}
|
||||
|
||||
var filteredRows []table.Row
|
||||
for _, row := range m.Rows {
|
||||
if rowContainsQuery(row, m.query) {
|
||||
filteredRows = append(filteredRows, row)
|
||||
}
|
||||
}
|
||||
m.table.SetRows(filteredRows)
|
||||
}
|
||||
|
||||
func rowContainsQuery(row table.Row, query string) bool {
|
||||
for _, cell := range row {
|
||||
if strings.Contains(strings.ToLower(cell), strings.ToLower(query)) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func InitAndRunTerm(obj *InteractiveHandler) *tea.Program {
|
||||
columns := []table.Column{
|
||||
{Title: "No.", Width: 5},
|
||||
{Title: "Name", Width: 20},
|
||||
{Title: "Ip", Width: 18},
|
||||
}
|
||||
|
||||
t := table.New(
|
||||
table.WithColumns(columns),
|
||||
table.WithFocused(true),
|
||||
table.WithHeight(7),
|
||||
)
|
||||
|
||||
s := table.DefaultStyles()
|
||||
s.Header = s.Header.
|
||||
BorderStyle(lipgloss.NormalBorder()).
|
||||
BorderForeground(lipgloss.Color("240")).
|
||||
BorderBottom(true).
|
||||
Bold(false)
|
||||
s.Selected = s.Selected.
|
||||
Foreground(lipgloss.Color("229")).
|
||||
Background(lipgloss.Color("57")).
|
||||
Bold(false)
|
||||
t.SetStyles(s)
|
||||
|
||||
tm := &TermModel{
|
||||
table: t,
|
||||
Object: obj,
|
||||
in: &ProxyReader{r: obj.Session},
|
||||
out: &ProxyWriter{w: obj.Session},
|
||||
hasMsg: make(chan struct{}),
|
||||
}
|
||||
|
||||
tm.updateRows()
|
||||
return tea.NewProgram(tm, tea.WithInput(tm.in), tea.WithOutput(tm.out))
|
||||
}
|
||||
|
||||
func (m *TermModel) updateRows() {
|
||||
assets, err := m.Object.AcquireAssets("", 0)
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error(), zap.String("module", "term"))
|
||||
return
|
||||
}
|
||||
var rows []table.Row
|
||||
for index, v1 := range assets {
|
||||
rows = append(rows, []string{strconv.Itoa(index), v1.Name, v1.Ip})
|
||||
}
|
||||
|
||||
m.Object.Locker.Lock()
|
||||
m.Object.Assets = assets
|
||||
m.Object.Locker.Unlock()
|
||||
m.SearchTime = time.Now()
|
||||
m.Rows = rows
|
||||
}
|
||||
|
||||
func (m *TermModel) convertRows() {
|
||||
switch m.Step {
|
||||
case ChooseAccount:
|
||||
var rows []table.Row
|
||||
for index, v := range m.Object.AccountsForSelect {
|
||||
rows = append(rows, table.Row{strconv.Itoa(index), v.Name, v.Account})
|
||||
}
|
||||
m.Rows = rows
|
||||
default:
|
||||
if time.Since(m.SearchTime) < time.Minute {
|
||||
var rows []table.Row
|
||||
for index, v1 := range m.Object.Assets {
|
||||
rows = append(rows, []string{strconv.Itoa(index), v1.Name, v1.Ip})
|
||||
}
|
||||
m.Rows = rows
|
||||
return
|
||||
}
|
||||
m.updateRows()
|
||||
}
|
||||
}
|
||||
|
||||
type nilWriter struct{}
|
||||
|
||||
func (nw nilWriter) Write(p []byte) (int, error) {
|
||||
return len(p), nil
|
||||
}
|
||||
|
||||
func (m *TermModel) ClearDataSource() {
|
||||
m.in.SetReader(nil)
|
||||
m.out.SetWriter(nil)
|
||||
}
|
||||
|
||||
func (m *TermModel) ResetSource() {
|
||||
m.in.SetReader(m.Object.Session)
|
||||
m.out.SetWriter(m.Object.Session)
|
||||
}
|
||||
|
||||
type ProxyWriter struct {
|
||||
lock sync.RWMutex
|
||||
w io.Writer
|
||||
}
|
||||
|
||||
func (pw *ProxyWriter) Write(p []byte) (n int, err error) {
|
||||
pw.lock.RLock()
|
||||
defer pw.lock.RUnlock()
|
||||
for pw.w == nil {
|
||||
time.Sleep(time.Millisecond * 50)
|
||||
}
|
||||
return pw.w.Write(p)
|
||||
}
|
||||
|
||||
func (pw *ProxyWriter) SetWriter(w io.Writer) {
|
||||
pw.lock.Lock()
|
||||
defer pw.lock.Unlock()
|
||||
pw.w = w
|
||||
}
|
||||
|
||||
type ProxyReader struct {
|
||||
lock sync.RWMutex
|
||||
r io.Reader
|
||||
hasMsg atomic.Bool
|
||||
}
|
||||
|
||||
func (pr *ProxyReader) Read(p []byte) (n int, err error) {
|
||||
pr.lock.RLock()
|
||||
defer pr.lock.RUnlock()
|
||||
for pr.r == nil || pr.hasMsg.Load() {
|
||||
time.Sleep(time.Millisecond * 100)
|
||||
}
|
||||
|
||||
n, err = pr.r.Read(p)
|
||||
pr.hasMsg.Store(true)
|
||||
return
|
||||
}
|
||||
|
||||
func (pr *ProxyReader) SetReader(r io.Reader) {
|
||||
pr.r = r
|
||||
}
|
154
backend/pkg/proto/ssh/record/asciinema.go
Normal file
154
backend/pkg/proto/ssh/record/asciinema.go
Normal file
@@ -0,0 +1,154 @@
|
||||
package record
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
gossh "github.com/gliderlabs/ssh"
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/veops/oneterm/pkg/logger"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/api"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/config"
|
||||
)
|
||||
|
||||
type Asciinema struct {
|
||||
Timestamp time.Time
|
||||
FilePath string
|
||||
|
||||
SessionId string
|
||||
Writer *os.File
|
||||
InChan chan string
|
||||
buf []string
|
||||
HasWidth bool
|
||||
}
|
||||
|
||||
func NewAsciinema(sessionId string, pty gossh.Pty) (asc *Asciinema, err error) {
|
||||
asc = &Asciinema{
|
||||
Timestamp: time.Now(),
|
||||
InChan: make(chan string, 20480),
|
||||
SessionId: sessionId,
|
||||
}
|
||||
if config.SSHConfig.RecordFilePath == "" {
|
||||
asc.FilePath, _ = os.Getwd()
|
||||
}
|
||||
asc.FilePath = filepath.Join(asc.FilePath, sessionId+".cast")
|
||||
|
||||
castFile, err := os.Create(asc.FilePath)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
asc.Writer = castFile
|
||||
|
||||
head := map[string]any{
|
||||
"version": 2,
|
||||
"width": pty.Window.Width,
|
||||
"height": pty.Window.Height,
|
||||
"timestamp": asc.Timestamp.Unix(),
|
||||
"env": map[string]any{
|
||||
"SHELL": "/bin/bash",
|
||||
"TERM": "xterm-256color",
|
||||
},
|
||||
}
|
||||
s, _ := json.Marshal(head)
|
||||
if pty.Window.Width == 0 {
|
||||
asc.buf = append(asc.buf, string(s))
|
||||
} else {
|
||||
asc.HasWidth = true
|
||||
_, err = castFile.Write(s)
|
||||
if err != nil {
|
||||
return asc, err
|
||||
}
|
||||
_, err = castFile.WriteString("\r\n")
|
||||
if err != nil {
|
||||
return asc, err
|
||||
}
|
||||
}
|
||||
return asc, err
|
||||
}
|
||||
|
||||
func (a *Asciinema) Write(data []byte) error {
|
||||
s := make([]any, 3)
|
||||
s[0] = (float64(time.Now().UnixMicro() - a.Timestamp.UnixMicro())) / 1000 / 1000
|
||||
s[1] = "o"
|
||||
s[2] = string(data)
|
||||
res, err := json.Marshal(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !a.HasWidth {
|
||||
a.buf = append(a.buf, string(res))
|
||||
} else {
|
||||
_, err = a.Writer.Write(append(res, []byte("\r\n")...))
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *Asciinema) RemoteWrite(rec string) {
|
||||
a.InChan <- rec
|
||||
for v := range a.InChan {
|
||||
err := api.AddReplay(a.SessionId, map[string]string{
|
||||
"session_id": a.SessionId,
|
||||
"body": v,
|
||||
})
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a *Asciinema) Close() {
|
||||
a.Writer.Close()
|
||||
err := api.AddReplayFile(a.SessionId, a.FilePath)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error())
|
||||
}
|
||||
err = os.Remove(a.FilePath)
|
||||
if err != nil {
|
||||
logger.L.Warn(err.Error(), zap.String("module", "asciinema"))
|
||||
}
|
||||
}
|
||||
|
||||
func (a *Asciinema) Resize(height, width int) error {
|
||||
if !a.HasWidth {
|
||||
a.ReWriteZeroWidth(height, width)
|
||||
}
|
||||
s := make([]any, 3)
|
||||
s[0] = (float64(time.Now().UnixMicro() - a.Timestamp.UnixMicro())) / 1000 / 1000
|
||||
s[1] = "r"
|
||||
s[2] = fmt.Sprintf("%dx%d", width, height)
|
||||
|
||||
res, err := json.Marshal(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = a.Writer.Write(append(res, []byte("\r\n")...))
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *Asciinema) ReWriteZeroWidth(height, width int) {
|
||||
defer func() {
|
||||
a.HasWidth = true
|
||||
}()
|
||||
if len(a.buf) > 0 {
|
||||
head := map[string]any{}
|
||||
er := json.Unmarshal([]byte(a.buf[0]), &head)
|
||||
if er == nil {
|
||||
head["width"] = width
|
||||
head["height"] = height
|
||||
s, er := json.Marshal(head)
|
||||
if er == nil {
|
||||
a.buf[0] = string(s)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_, _ = a.Writer.WriteString(strings.Join(a.buf, "\r\n"))
|
||||
_, _ = a.Writer.WriteString("\r\n")
|
||||
return
|
||||
}
|
7
backend/pkg/proto/ssh/record/record.go
Normal file
7
backend/pkg/proto/ssh/record/record.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package record
|
||||
|
||||
type Record interface {
|
||||
Write(record []byte) error
|
||||
Close()
|
||||
Resize(height, width int) error
|
||||
}
|
40
backend/pkg/proto/ssh/ssh.go
Normal file
40
backend/pkg/proto/ssh/ssh.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/pires/go-proxyproto"
|
||||
|
||||
"github.com/veops/oneterm/pkg/logger"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/handler"
|
||||
)
|
||||
|
||||
func Run(Addr, apiHost, token, privateKeyPath, secretKey string) error {
|
||||
s, er := handler.Init(Addr, apiHost, token, privateKeyPath, secretKey)
|
||||
|
||||
if er != nil {
|
||||
return er
|
||||
}
|
||||
go func() {
|
||||
ln, err := net.Listen("tcp", s.Addr)
|
||||
if err != nil {
|
||||
logger.L.Fatal(err.Error())
|
||||
}
|
||||
|
||||
proxyListener := &proxyproto.Listener{
|
||||
Listener: ln,
|
||||
ReadHeaderTimeout: 10 * time.Second,
|
||||
}
|
||||
defer proxyListener.Close()
|
||||
|
||||
err = s.Serve(proxyListener)
|
||||
if err != nil {
|
||||
logger.L.Fatal(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
}()
|
||||
|
||||
return nil
|
||||
}
|
93
backend/pkg/proto/ssh/tasks/task.go
Normal file
93
backend/pkg/proto/ssh/tasks/task.go
Normal file
@@ -0,0 +1,93 @@
|
||||
package tasks
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"go.uber.org/zap"
|
||||
|
||||
"github.com/veops/oneterm/pkg/logger"
|
||||
"github.com/veops/oneterm/pkg/proto/ssh/api"
|
||||
"github.com/veops/oneterm/pkg/server/model"
|
||||
)
|
||||
|
||||
func checkPort(server string, port int, timeout time.Duration) bool {
|
||||
address := fmt.Sprintf("%s:%d", server, port)
|
||||
conn, err := net.DialTimeout("tcp", address, timeout)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
_ = conn.Close()
|
||||
return true
|
||||
}
|
||||
|
||||
func checkAssets(assets []*model.Asset) (result map[int]map[string]any, err error) {
|
||||
type St struct {
|
||||
Id int
|
||||
State bool
|
||||
}
|
||||
result = map[int]map[string]any{}
|
||||
statusChan := make(chan *St, len(assets))
|
||||
var wg sync.WaitGroup
|
||||
for i := range assets {
|
||||
wg.Add(1)
|
||||
go func(asset *model.Asset) {
|
||||
defer wg.Done()
|
||||
var connected bool
|
||||
for _, protocol := range asset.Protocols {
|
||||
tmp := strings.Split(protocol, ":")
|
||||
port := 22
|
||||
var er error
|
||||
if len(tmp) == 2 {
|
||||
port, er = strconv.Atoi(tmp[1])
|
||||
if er != nil {
|
||||
continue
|
||||
}
|
||||
}
|
||||
connected = checkPort(asset.Ip, port, time.Second*5)
|
||||
if connected {
|
||||
break
|
||||
}
|
||||
}
|
||||
statusChan <- &St{Id: asset.Id, State: connected}
|
||||
}(assets[i])
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
for i := 0; i < len(statusChan); i++ {
|
||||
v := <-statusChan
|
||||
result[v.Id] = map[string]any{"connectable": v.State}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func LoopCheck(ctx context.Context, host, token string) {
|
||||
assetServer := api.NewAssetServer(host, token)
|
||||
ticker := time.NewTicker(time.Second)
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
ticker.Reset(time.Hour)
|
||||
res, err := assetServer.AllAssets()
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error(), zap.String("module", "LoopCheck"))
|
||||
break
|
||||
}
|
||||
status, err := checkAssets(res)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error(), zap.String("module", "LoopCheck"))
|
||||
}
|
||||
err = assetServer.ChangeState(status)
|
||||
if err != nil {
|
||||
logger.L.Error(err.Error(), zap.String("module", "LoopCheck"))
|
||||
}
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
52
backend/pkg/util/aes.go
Normal file
52
backend/pkg/util/aes.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/aes"
|
||||
"crypto/cipher"
|
||||
"encoding/base64"
|
||||
)
|
||||
|
||||
var (
|
||||
key = []byte("thisis32bitlongpassphraseimusing")
|
||||
iv = []byte("0123456789abcdef")
|
||||
)
|
||||
|
||||
func EncryptAES(plainText string) string {
|
||||
block, _ := aes.NewCipher(key)
|
||||
bs := []byte(plainText)
|
||||
bs = paddingPKCS7(bs, aes.BlockSize)
|
||||
|
||||
mode := cipher.NewCBCEncrypter(block, iv)
|
||||
mode.CryptBlocks(bs, bs)
|
||||
|
||||
return base64.StdEncoding.EncodeToString(bs)
|
||||
}
|
||||
|
||||
func DecryptAES(cipherText string) string {
|
||||
bs, _ := base64.StdEncoding.DecodeString(cipherText)
|
||||
block, err := aes.NewCipher(key)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
mode := cipher.NewCBCDecrypter(block, iv)
|
||||
mode.CryptBlocks(bs, bs)
|
||||
|
||||
return string(unPaddingPKCS7(bs))
|
||||
}
|
||||
|
||||
func paddingPKCS7(plaintext []byte, blockSize int) []byte {
|
||||
paddingSize := blockSize - len(plaintext)%blockSize
|
||||
paddingText := bytes.Repeat([]byte{byte(paddingSize)}, paddingSize)
|
||||
return append(plaintext, paddingText...)
|
||||
}
|
||||
|
||||
func unPaddingPKCS7(s []byte) []byte {
|
||||
length := len(s)
|
||||
if length == 0 {
|
||||
return s
|
||||
}
|
||||
unPadding := int(s[length-1])
|
||||
return s[:(length - unPadding)]
|
||||
}
|
55
backend/pkg/util/aes_test.go
Normal file
55
backend/pkg/util/aes_test.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEncryptAES(t *testing.T) {
|
||||
type args struct {
|
||||
plaintext string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "Test 1",
|
||||
args: args{
|
||||
plaintext: "123456789abcdefghijklmnopqrstuvwxyz",
|
||||
},
|
||||
want: "hrr23HSXrZEOw5haacoj32QJLrHdpj42jaQcPVRf9AI8SzeSdWJhzTrYgsOgmNoN",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := EncryptAES(tt.args.plaintext); got != tt.want {
|
||||
t.Errorf("EncryptAES() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestDecryptAES(t *testing.T) {
|
||||
type args struct {
|
||||
cipherText string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "Test 1",
|
||||
args: args{cipherText: "hrr23HSXrZEOw5haacoj32QJLrHdpj42jaQcPVRf9AI8SzeSdWJhzTrYgsOgmNoN"},
|
||||
want: "123456789abcdefghijklmnopqrstuvwxyz",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := DecryptAES(tt.args.cipherText); got != tt.want {
|
||||
t.Errorf("DecryptAES() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
52
backend/pkg/util/requests.go
Normal file
52
backend/pkg/util/requests.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func ClientRequest(client *http.Client, method, url string, headers map[string]string, data []byte) (int, []byte, error) {
|
||||
var res []byte
|
||||
var code = 0
|
||||
req, err := http.NewRequest(strings.ToUpper(method), url, bytes.NewBuffer(data))
|
||||
if err != nil {
|
||||
return code, res, err
|
||||
}
|
||||
|
||||
for k, v := range headers {
|
||||
req.Header.Set(k, v)
|
||||
}
|
||||
//req.AddCookie(&http.Cookie{Name: "session", Value: ""})
|
||||
response, err := client.Do(req)
|
||||
if err != nil && response == nil {
|
||||
return code, res, fmt.Errorf("error: %+v", err)
|
||||
} else {
|
||||
if response != nil {
|
||||
defer response.Body.Close()
|
||||
r, err := io.ReadAll(response.Body)
|
||||
return response.StatusCode, r, err
|
||||
}
|
||||
return code, res, nil
|
||||
}
|
||||
}
|
||||
|
||||
func PostForm(reqUrl string, content map[string]string) (int, []byte, error) {
|
||||
data := url.Values{}
|
||||
for k, v := range content {
|
||||
data.Add(k, v)
|
||||
}
|
||||
|
||||
resp, err := http.PostForm(reqUrl, data)
|
||||
if resp != nil {
|
||||
defer resp.Body.Close()
|
||||
}
|
||||
if err != nil {
|
||||
return 0, nil, err
|
||||
}
|
||||
r, err := io.ReadAll(resp.Body)
|
||||
return resp.StatusCode, r, err
|
||||
}
|
164
backend/pkg/util/util.go
Normal file
164
backend/pkg/util/util.go
Normal file
@@ -0,0 +1,164 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
func GetLocalIP() (string, error) {
|
||||
interfaces, err := net.Interfaces()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
for _, iface := range interfaces {
|
||||
addrs, err := iface.Addrs()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
for _, addr := range addrs {
|
||||
ipNet, ok := addr.(*net.IPNet)
|
||||
if ok && !ipNet.IP.IsLoopback() && ipNet.IP.To4() != nil {
|
||||
return ipNet.IP.String(), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "", errors.New("cannot find the client IP address")
|
||||
}
|
||||
|
||||
func GetMacAddrs() (macAddrs []string) {
|
||||
netInterfaces, err := net.Interfaces()
|
||||
if err != nil {
|
||||
return macAddrs
|
||||
}
|
||||
|
||||
for _, netInterface := range netInterfaces {
|
||||
macAddr := netInterface.HardwareAddr.String()
|
||||
if len(macAddr) == 0 {
|
||||
continue
|
||||
}
|
||||
macAddrs = append(macAddrs, macAddr)
|
||||
}
|
||||
return macAddrs
|
||||
}
|
||||
|
||||
func CallReflect(any any, name string, args ...any) []reflect.Value {
|
||||
inputs := make([]reflect.Value, len(args))
|
||||
for i := range args {
|
||||
inputs[i] = reflect.ValueOf(args[i])
|
||||
}
|
||||
|
||||
if v := reflect.ValueOf(any).MethodByName(name); v.String() == "<invalid Value>" {
|
||||
return nil
|
||||
} else {
|
||||
return v.Call(inputs)
|
||||
}
|
||||
}
|
||||
|
||||
func SetUnExportedStructField(ptr any, field string, newValue any) error {
|
||||
v := reflect.ValueOf(ptr).Elem().FieldByName(field)
|
||||
v = reflect.NewAt(v.Type(), unsafe.Pointer(v.UnsafeAddr())).Elem()
|
||||
nv := reflect.ValueOf(newValue)
|
||||
if v.Kind() != nv.Kind() {
|
||||
return fmt.Errorf("expected kind :%s, get kind: %s", v.Kind(), nv.Kind())
|
||||
}
|
||||
v.Set(nv)
|
||||
return nil
|
||||
}
|
||||
|
||||
//func CopyStruct(source interface{}, dest interface{}) {
|
||||
// val := reflect.ValueOf(source)
|
||||
// destVal := reflect.ValueOf(dest).Elem()
|
||||
//
|
||||
// for i := 0; i < val.NumField(); i++ {
|
||||
// field := val.Type().Field(i).Name
|
||||
// destField := destVal.FieldByName(field)
|
||||
// if destField.IsValid() && destField.CanSet() {
|
||||
// destField.Set(val.Field(i))
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
func CopyStruct(src, dst interface{}) error {
|
||||
srcVal := reflect.ValueOf(src)
|
||||
dstVal := reflect.ValueOf(dst).Elem()
|
||||
|
||||
for i := 0; i < srcVal.NumField(); i++ {
|
||||
srcField := srcVal.Type().Field(i)
|
||||
dstField, found := dstVal.Type().FieldByName(srcField.Name)
|
||||
|
||||
if found {
|
||||
if dstField.Type.AssignableTo(srcField.Type) {
|
||||
dstVal.FieldByName(srcField.Name).Set(srcVal.Field(i))
|
||||
} else {
|
||||
return fmt.Errorf("Cannot assign %s field", srcField.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func ToTimeHookFunc() mapstructure.DecodeHookFunc {
|
||||
return func(
|
||||
f reflect.Type,
|
||||
t reflect.Type,
|
||||
data interface{}) (interface{}, error) {
|
||||
if t != reflect.TypeOf(time.Time{}) {
|
||||
return data, nil
|
||||
}
|
||||
|
||||
switch f.Kind() {
|
||||
case reflect.String:
|
||||
return time.Parse(time.RFC3339, data.(string))
|
||||
case reflect.Float64:
|
||||
return time.Unix(0, int64(data.(float64))*int64(time.Millisecond)), nil
|
||||
case reflect.Int64:
|
||||
return time.Unix(0, data.(int64)*int64(time.Millisecond)), nil
|
||||
default:
|
||||
return data, nil
|
||||
}
|
||||
// Convert it by parsing
|
||||
}
|
||||
}
|
||||
|
||||
func decodeHook(f reflect.Type, t reflect.Type, data interface{}) (interface{}, error) {
|
||||
if f.Kind() == reflect.Int && t.Kind() == reflect.String {
|
||||
return strconv.Itoa(data.(int)), nil
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func DecodeStruct(dst, src any) error {
|
||||
decoder, _ := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
||||
TagName: "json",
|
||||
Result: &dst,
|
||||
DecodeHook: mapstructure.ComposeDecodeHookFunc(
|
||||
ToTimeHookFunc()),
|
||||
})
|
||||
return decoder.Decode(src)
|
||||
}
|
||||
|
||||
func ListFiles(path string) (res []string, err error) {
|
||||
err = filepath.Walk(path, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !info.IsDir() && filepath.Ext(path) == ".toml" {
|
||||
res = append(res, path)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
return
|
||||
}
|
215
backend/sql/mysql/init.sql
Normal file
215
backend/sql/mysql/init.sql
Normal file
@@ -0,0 +1,215 @@
|
||||
-- Active: 1700721140603@@192.168.20.82@53306@oneterm
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS oneterm;
|
||||
|
||||
CREATE TABLE
|
||||
IF NOT EXISTS oneterm.account(
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`account_type` int NOT NULL DEFAULT 0,
|
||||
`account` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`password` TEXT NOT NULL,
|
||||
`pk` TEXT NOT NULL,
|
||||
`phrase` TEXT NOT NULL,
|
||||
`resource_id` INT NOT NULL DEFAULT 0,
|
||||
`creator_id` INT NOT NULL DEFAULT 0,
|
||||
`updater_id` INT NOT NULL DEFAULT 0,
|
||||
`created_at` TIMESTAMP NOT NULL,
|
||||
`updated_at` TIMESTAMP NOT NULL,
|
||||
`deleted_at` BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name_del` (`name`, `deleted_at`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
|
||||
|
||||
CREATE TABLE
|
||||
IF NOT EXISTS oneterm.asset(
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`ci_id` INT NOT NULL DEFAULT 0,
|
||||
`name` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`comment` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`parent_id` INT NOT NULL DEFAULT 0,
|
||||
`ip` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`protocols` JSON NOT NULL,
|
||||
`gateway_id` INT NOT NULL DEFAULT 0,
|
||||
`authorization` JSON NOT NULL,
|
||||
`start` TIMESTAMP,
|
||||
`end` TIMESTAMP,
|
||||
`cmd_ids` JSON NOT NULL,
|
||||
`ranges` JSON NOT NULL,
|
||||
`allow` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`connectable` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`resource_id` INT NOT NULL DEFAULT 0,
|
||||
`creator_id` INT NOT NULL DEFAULT 0,
|
||||
`created_at` TIMESTAMP NOT NULL,
|
||||
`updater_id` INT NOT NULL DEFAULT 0,
|
||||
`updated_at` TIMESTAMP NOT NULL,
|
||||
`deleted_at` BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name_del` (`name`, `deleted_at`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
|
||||
|
||||
CREATE TABLE
|
||||
IF NOT EXISTS oneterm.command(
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`cmds` JSON NOT NULL,
|
||||
`enable` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`resource_id` INT NOT NULL DEFAULT 0,
|
||||
`creator_id` INT NOT NULL DEFAULT 0,
|
||||
`updater_id` INT NOT NULL DEFAULT 0,
|
||||
`created_at` TIMESTAMP NOT NULL,
|
||||
`updated_at` TIMESTAMP NOT NULL,
|
||||
`deleted_at` BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name_del` (`name`, `deleted_at`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
|
||||
|
||||
CREATE TABLE
|
||||
IF NOT EXISTS oneterm.gateway(
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`host` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`port` INT NOT NULL DEFAULT 0,
|
||||
`account_type` int NOT NULL DEFAULT 0,
|
||||
`account` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`password` TEXT NOT NULL,
|
||||
`pk` TEXT NOT NULL,
|
||||
`phrase` TEXT NOT NULL,
|
||||
`resource_id` INT NOT NULL DEFAULT 0,
|
||||
`creator_id` INT NOT NULL DEFAULT 0,
|
||||
`updater_id` INT NOT NULL DEFAULT 0,
|
||||
`created_at` TIMESTAMP NOT NULL,
|
||||
`updated_at` TIMESTAMP NOT NULL,
|
||||
`deleted_at` BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `name_del` (`name`, `deleted_at`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
|
||||
|
||||
CREATE TABLE
|
||||
IF NOT EXISTS oneterm.node(
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`name` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`comment` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`parent_id` INT NOT NULL DEFAULT 0,
|
||||
`ip` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`protocols` JSON NOT NULL,
|
||||
`gateway_id` INT NOT NULL DEFAULT 0,
|
||||
`authorization` JSON NOT NULL,
|
||||
`start` TIMESTAMP,
|
||||
`end` TIMESTAMP,
|
||||
`cmd_ids` JSON NOT NULL,
|
||||
`ranges` JSON NOT NULL,
|
||||
`allow` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`type_id` INT NOT NULL DEFAULT 0,
|
||||
`mapping` JSON NOT NULL,
|
||||
`filters` TEXT NOT NULL,
|
||||
`enable` TINYINT(1) NOT NULL DEFAULT 0,
|
||||
`frequency` DOUBLE NOT NULL DEFAULT 0,
|
||||
`creator_id` INT NOT NULL DEFAULT 0,
|
||||
`created_at` TIMESTAMP NOT NULL,
|
||||
`updater_id` INT NOT NULL DEFAULT 0,
|
||||
`updated_at` TIMESTAMP NOT NULL,
|
||||
`deleted_at` BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
|
||||
|
||||
CREATE TABLE
|
||||
IF NOT EXISTS oneterm.public_key(
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`uid` INT NOT NULL DEFAULT 0,
|
||||
`username` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`name` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`mac` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`pk` TEXT NOT NULL,
|
||||
`creator_id` INT NOT NULL DEFAULT 0,
|
||||
`updater_id` INT NOT NULL DEFAULT 0,
|
||||
`created_at` TIMESTAMP NOT NULL,
|
||||
`updated_at` TIMESTAMP NOT NULL,
|
||||
`deleted_at` BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `creator_id_name_del` (
|
||||
`creator_id`,
|
||||
`name`,
|
||||
`deleted_at`
|
||||
)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
|
||||
|
||||
CREATE TABLE
|
||||
IF NOT EXISTS oneterm.history(
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`remote_ip` VARCHAR(64) NOT NULL DEFAULT 0,
|
||||
`type` VARCHAR(64) NOT NULL DEFAULT 0,
|
||||
`target_id` INT NOT NULL DEFAULT 0,
|
||||
`old` JSON NOT NULL,
|
||||
`new` JSON NOT NULL,
|
||||
`action_type` INT NOT NULL DEFAULT 0,
|
||||
`creator_id` INT NOT NULL DEFAULT 0,
|
||||
`created_at` TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
|
||||
|
||||
CREATE TABLE
|
||||
IF NOT EXISTS oneterm.session(
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`session_type` INT NOT NULL DEFAULT 0,
|
||||
`session_id` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`uid` INT NOT NULL DEFAULT 0,
|
||||
`user_name` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`asset_id` INT NOT NULL DEFAULT 0,
|
||||
`asset_info` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`account_id` INT NOT NULL DEFAULT 0,
|
||||
`account_info` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`gateway_id` INT NOT NULL DEFAULT 0,
|
||||
`gateway_info` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`protocol` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`client_ip` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`status` INT NOT NULL DEFAULT 0,
|
||||
`created_at` TIMESTAMP NOT NULL,
|
||||
`updated_at` TIMESTAMP NOT NULL,
|
||||
`closed_at` TIMESTAMP,
|
||||
PRIMARY KEY(`id`),
|
||||
UNIQUE KEY `session_id` (`session_id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
|
||||
|
||||
CREATE TABLE
|
||||
IF NOT EXISTS oneterm.session_cmd(
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`session_id` VARCHAR(64) NOT NULL DEFAULT '',
|
||||
`cmd` TEXT NOT NULL,
|
||||
`result` TEXT NOT NULL,
|
||||
`level` INT NOT NULL DEFAULT 0,
|
||||
`created_at` TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
|
||||
|
||||
CREATE TABLE
|
||||
IF NOT EXISTS oneterm.authorization(
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`asset_id` INT NOT NULL DEFAULT 0,
|
||||
`account_id` INT NOT NULL DEFAULT 0,
|
||||
`resource_id` INT NOT NULL DEFAULT 0,
|
||||
`creator_id` INT NOT NULL DEFAULT 0,
|
||||
`created_at` TIMESTAMP NOT NULL,
|
||||
`updater_id` INT NOT NULL DEFAULT 0,
|
||||
`updated_at` TIMESTAMP NOT NULL,
|
||||
`deleted_at` BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`),
|
||||
UNIQUE KEY `asset_account_id_del` (
|
||||
`asset_id`,
|
||||
`account_id`,
|
||||
`deleted_at`
|
||||
)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
|
||||
|
||||
CREATE TABLE
|
||||
IF NOT EXISTS oneterm.config(
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`timeout` INT NOT NULL,
|
||||
`creator_id` INT NOT NULL DEFAULT 0,
|
||||
`created_at` TIMESTAMP NOT NULL,
|
||||
`updater_id` INT NOT NULL DEFAULT 0,
|
||||
`updated_at` TIMESTAMP NOT NULL,
|
||||
`deleted_at` BIGINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY(`id`),
|
||||
UNIQUE KEY `deleted_at` (`deleted_at`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
|
Reference in New Issue
Block a user