mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-24 16:40:26 +00:00
make the sdk a separate module
The SFTPGo SDK now is at the following URL https://github.com/sftpgo/sdk Fixes #657 Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
0e2d673889
commit
ba3548c2c3
76 changed files with 73 additions and 5767 deletions
|
@ -10,12 +10,12 @@ import (
|
|||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/common"
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/service"
|
||||
"github.com/drakkan/sftpgo/v2/sftpd"
|
||||
"github.com/drakkan/sftpgo/v2/version"
|
||||
|
|
|
@ -14,12 +14,13 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/sftpgo/sdk/plugin/notifier"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/httpclient"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/plugin"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/notifier"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
)
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@ import (
|
|||
|
||||
"github.com/lithammer/shortuuid/v3"
|
||||
"github.com/rs/xid"
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/sftpgo/sdk/plugin/notifier"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/plugin"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/notifier"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
||||
|
|
|
@ -14,13 +14,13 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/alexedwards/argon2id"
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
|
|
@ -12,10 +12,10 @@ import (
|
|||
|
||||
ftpserver "github.com/fclairamb/ftpserverlib"
|
||||
"github.com/pkg/sftp"
|
||||
"github.com/sftpgo/sdk"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
|
|
@ -10,11 +10,11 @@ import (
|
|||
|
||||
"github.com/pkg/sftp"
|
||||
"github.com/rs/xid"
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/smtp"
|
||||
)
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/pquerna/otp/totp"
|
||||
"github.com/rs/xid"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/crypto/ssh"
|
||||
|
@ -37,7 +38,6 @@ import (
|
|||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/mfa"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
|
|
@ -7,12 +7,12 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
sdkkms "github.com/sftpgo/sdk/kms"
|
||||
"github.com/spf13/viper"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -19,7 +20,6 @@ import (
|
|||
"github.com/drakkan/sftpgo/v2/httpd"
|
||||
"github.com/drakkan/sftpgo/v2/mfa"
|
||||
"github.com/drakkan/sftpgo/v2/plugin"
|
||||
sdkkms "github.com/drakkan/sftpgo/v2/sdk/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sftpd"
|
||||
"github.com/drakkan/sftpgo/v2/smtp"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
|
|
|
@ -11,10 +11,11 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/sftpgo/sdk/plugin/notifier"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/httpclient"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/plugin"
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/notifier"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
)
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ import (
|
|||
"github.com/alexedwards/argon2id"
|
||||
"github.com/go-chi/render"
|
||||
"github.com/rs/xid"
|
||||
"github.com/sftpgo/sdk"
|
||||
passwordvalidator "github.com/wagslane/go-password-validator"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
"golang.org/x/crypto/pbkdf2"
|
||||
|
@ -51,7 +52,6 @@ import (
|
|||
"github.com/drakkan/sftpgo/v2/metric"
|
||||
"github.com/drakkan/sftpgo/v2/mfa"
|
||||
"github.com/drakkan/sftpgo/v2/plugin"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
|
|
@ -15,10 +15,11 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/sftpgo/sdk"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/mfa"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
|
|
@ -33,6 +33,6 @@ In theory, because the plugin interface is HTTP, you could even develop a plugin
|
|||
|
||||
Developing a plugin is simple. The only knowledge necessary to write a plugin is basic command-line skills and basic knowledge of the [Go programming language](http://golang.org/).
|
||||
|
||||
Your plugin implementation needs to satisfy the interface for the plugin type you want to build. You can find these definitions in the [docs](https://pkg.go.dev/github.com/drakkan/sftpgo/v2/sdk/plugin#section-directories).
|
||||
Your plugin implementation needs to satisfy the interface for the plugin type you want to build. You can find these definitions in the [docs](https://pkg.go.dev/github.com/sftpgo/sdk/plugin#section-directories).
|
||||
|
||||
The SFTPGo plugin system uses the HashiCorp [go-plugin](https://github.com/hashicorp/go-plugin) library. Please refer to its documentation for more in-depth information on writing plugins.
|
||||
|
|
|
@ -13,13 +13,13 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/minio/sio"
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/common"
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/httpdtest"
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
)
|
||||
|
||||
func TestBasicFTPHandlingCryptFs(t *testing.T) {
|
||||
|
|
|
@ -24,6 +24,8 @@ import (
|
|||
"github.com/pquerna/otp"
|
||||
"github.com/pquerna/otp/totp"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sftpgo/sdk"
|
||||
sdkkms "github.com/sftpgo/sdk/kms"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
|
@ -35,8 +37,6 @@ import (
|
|||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/mfa"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
sdkkms "github.com/drakkan/sftpgo/v2/sdk/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sftpd"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
|
|
@ -14,12 +14,12 @@ import (
|
|||
"github.com/eikenb/pipeat"
|
||||
ftpserver "github.com/fclairamb/ftpserverlib"
|
||||
"github.com/pires/go-proxyproto"
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/common"
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
||||
|
|
7
go.mod
7
go.mod
|
@ -39,6 +39,7 @@ require (
|
|||
github.com/rs/cors v1.8.2
|
||||
github.com/rs/xid v1.3.0
|
||||
github.com/rs/zerolog v1.26.2-0.20211219225053-665519c4da50
|
||||
github.com/sftpgo/sdk v0.0.0-20220106101837-50e87c59705a
|
||||
github.com/shirou/gopsutil/v3 v3.21.11
|
||||
github.com/spf13/afero v1.7.1
|
||||
github.com/spf13/cobra v1.3.0
|
||||
|
@ -52,12 +53,10 @@ require (
|
|||
go.uber.org/automaxprocs v1.4.0
|
||||
gocloud.dev v0.24.0
|
||||
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3
|
||||
golang.org/x/net v0.0.0-20211209124913-491a49abca63
|
||||
golang.org/x/net v0.0.0-20220105145211-5b0dc2dfae98
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
|
||||
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11
|
||||
google.golang.org/api v0.63.0
|
||||
google.golang.org/grpc v1.43.0
|
||||
google.golang.org/protobuf v1.27.1
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0
|
||||
)
|
||||
|
||||
|
@ -132,6 +131,8 @@ require (
|
|||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb // indirect
|
||||
google.golang.org/grpc v1.43.0 // indirect
|
||||
google.golang.org/protobuf v1.27.1 // indirect
|
||||
gopkg.in/ini.v1 v1.66.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
|
|
2
go.sum
2
go.sum
|
@ -740,6 +740,8 @@ github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdh
|
|||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||
github.com/secsy/goftp v0.0.0-20200609142545-aa2de14babf4 h1:PT+ElG/UUFMfqy5HrxJxNzj3QBOf7dZwupeVC+mG1Lo=
|
||||
github.com/secsy/goftp v0.0.0-20200609142545-aa2de14babf4/go.mod h1:MnkX001NG75g3p8bhFycnyIjeQoOjGL6CEIsdE/nKSY=
|
||||
github.com/sftpgo/sdk v0.0.0-20220106101837-50e87c59705a h1:JJc19rE0eW2knPa/KIFYvqyu25CwzKltJ5Cw1kK3o4A=
|
||||
github.com/sftpgo/sdk v0.0.0-20220106101837-50e87c59705a/go.mod h1:Bhgac6kiwIziILXLzH4wepT8lQXyhF83poDXqZorN6Q=
|
||||
github.com/shirou/gopsutil/v3 v3.21.11 h1:d5tOAP5+bmJ8Hf2+4bxOSkQ/64+sjEbjU9nSW9nJgG0=
|
||||
github.com/shirou/gopsutil/v3 v3.21.11/go.mod h1:BToYZVTlSVlfazpDDYFnsVZLaoRG+g8ufT6fPQLdJzA=
|
||||
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
|
||||
|
|
|
@ -5,9 +5,10 @@ import (
|
|||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/sftpgo/sdk/plugin/eventsearcher"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/plugin"
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/eventsearcher"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,11 +7,11 @@ import (
|
|||
"strconv"
|
||||
|
||||
"github.com/go-chi/render"
|
||||
"github.com/sftpgo/sdk"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/common"
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/smtp"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
|
|
|
@ -34,6 +34,8 @@ import (
|
|||
"github.com/pquerna/otp/totp"
|
||||
"github.com/rs/xid"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sftpgo/sdk"
|
||||
sdkkms "github.com/sftpgo/sdk/kms"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
|
@ -49,8 +51,6 @@ import (
|
|||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/mfa"
|
||||
"github.com/drakkan/sftpgo/v2/plugin"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
sdkkms "github.com/drakkan/sftpgo/v2/sdk/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sftpd"
|
||||
"github.com/drakkan/sftpgo/v2/smtp"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
|
|
|
@ -28,6 +28,7 @@ import (
|
|||
"github.com/lestrrat-go/jwx/jwa"
|
||||
"github.com/lestrrat-go/jwx/jwt"
|
||||
"github.com/rs/xid"
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
|
@ -35,7 +36,6 @@ import (
|
|||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/plugin"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
|
|
@ -10,11 +10,11 @@ import (
|
|||
"github.com/go-chi/jwtauth/v5"
|
||||
"github.com/lestrrat-go/jwx/jwt"
|
||||
"github.com/rs/xid"
|
||||
"github.com/sftpgo/sdk"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/common"
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
)
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ import (
|
|||
"github.com/lestrrat-go/jwx/jwa"
|
||||
"github.com/rs/cors"
|
||||
"github.com/rs/xid"
|
||||
"github.com/sftpgo/sdk"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/common"
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/mfa"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/smtp"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/version"
|
||||
|
|
|
@ -13,13 +13,13 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/go-chi/render"
|
||||
"github.com/sftpgo/sdk"
|
||||
sdkkms "github.com/sftpgo/sdk/kms"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/common"
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/mfa"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
sdkkms "github.com/drakkan/sftpgo/v2/sdk/kms"
|
||||
"github.com/drakkan/sftpgo/v2/smtp"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/version"
|
||||
|
|
|
@ -18,11 +18,11 @@ import (
|
|||
|
||||
"github.com/go-chi/render"
|
||||
"github.com/rs/xid"
|
||||
"github.com/sftpgo/sdk"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/common"
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/mfa"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/smtp"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/version"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package kms
|
||||
|
||||
import (
|
||||
sdkkms "github.com/drakkan/sftpgo/v2/sdk/kms"
|
||||
sdkkms "github.com/sftpgo/sdk/kms"
|
||||
)
|
||||
|
||||
// BaseSecret defines the base struct shared among all the secret providers
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"errors"
|
||||
"io"
|
||||
|
||||
sdkkms "github.com/drakkan/sftpgo/v2/sdk/kms"
|
||||
sdkkms "github.com/sftpgo/sdk/kms"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -8,8 +8,9 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
sdkkms "github.com/sftpgo/sdk/kms"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
sdkkms "github.com/drakkan/sftpgo/v2/sdk/kms"
|
||||
)
|
||||
|
||||
// SecretProvider defines the interface for a KMS secrets provider
|
||||
|
|
|
@ -7,10 +7,9 @@ import (
|
|||
"encoding/hex"
|
||||
"io"
|
||||
|
||||
sdkkms "github.com/sftpgo/sdk/kms"
|
||||
"gocloud.dev/secrets/localsecrets"
|
||||
"golang.org/x/crypto/hkdf"
|
||||
|
||||
sdkkms "github.com/drakkan/sftpgo/v2/sdk/kms"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/go-plugin"
|
||||
"github.com/sftpgo/sdk/plugin/auth"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/auth"
|
||||
)
|
||||
|
||||
// Supported auth scopes
|
||||
|
|
|
@ -8,11 +8,11 @@ import (
|
|||
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/go-plugin"
|
||||
sdkkms "github.com/sftpgo/sdk/kms"
|
||||
kmsplugin "github.com/sftpgo/sdk/plugin/kms"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
sdkkms "github.com/drakkan/sftpgo/v2/sdk/kms"
|
||||
kmsplugin "github.com/drakkan/sftpgo/v2/sdk/plugin/kms"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ import (
|
|||
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/go-plugin"
|
||||
"github.com/sftpgo/sdk/plugin/metadata"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/metadata"
|
||||
)
|
||||
|
||||
type metadataPlugin struct {
|
||||
|
|
|
@ -9,9 +9,9 @@ import (
|
|||
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/go-plugin"
|
||||
"github.com/sftpgo/sdk/plugin/notifier"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/notifier"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
)
|
||||
|
||||
|
|
|
@ -10,14 +10,14 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/sftpgo/sdk/plugin/auth"
|
||||
"github.com/sftpgo/sdk/plugin/eventsearcher"
|
||||
kmsplugin "github.com/sftpgo/sdk/plugin/kms"
|
||||
"github.com/sftpgo/sdk/plugin/metadata"
|
||||
"github.com/sftpgo/sdk/plugin/notifier"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/auth"
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/eventsearcher"
|
||||
kmsplugin "github.com/drakkan/sftpgo/v2/sdk/plugin/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/metadata"
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/notifier"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ import (
|
|||
|
||||
"github.com/hashicorp/go-hclog"
|
||||
"github.com/hashicorp/go-plugin"
|
||||
"github.com/sftpgo/sdk/plugin/eventsearcher"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/eventsearcher"
|
||||
)
|
||||
|
||||
type searcherPlugin struct {
|
||||
|
|
|
@ -1,244 +0,0 @@
|
|||
package sdk
|
||||
|
||||
import "github.com/drakkan/sftpgo/v2/sdk/kms"
|
||||
|
||||
// FilesystemProvider defines the supported storage filesystems
|
||||
type FilesystemProvider int
|
||||
|
||||
// supported values for FilesystemProvider
|
||||
const (
|
||||
LocalFilesystemProvider FilesystemProvider = iota // Local
|
||||
S3FilesystemProvider // AWS S3 compatible
|
||||
GCSFilesystemProvider // Google Cloud Storage
|
||||
AzureBlobFilesystemProvider // Azure Blob Storage
|
||||
CryptedFilesystemProvider // Local encrypted
|
||||
SFTPFilesystemProvider // SFTP
|
||||
)
|
||||
|
||||
// GetProviderByName returns the FilesystemProvider matching a given name
|
||||
// to provide backwards compatibility, numeric strings are accepted as well
|
||||
func GetProviderByName(name string) FilesystemProvider {
|
||||
switch name {
|
||||
case "0", "osfs":
|
||||
return LocalFilesystemProvider
|
||||
case "1", "s3fs":
|
||||
return S3FilesystemProvider
|
||||
case "2", "gcsfs":
|
||||
return GCSFilesystemProvider
|
||||
case "3", "azblobfs":
|
||||
return AzureBlobFilesystemProvider
|
||||
case "4", "cryptfs":
|
||||
return CryptedFilesystemProvider
|
||||
case "5", "sftpfs":
|
||||
return SFTPFilesystemProvider
|
||||
}
|
||||
|
||||
// TODO think about returning an error value instead of silently defaulting to LocalFilesystemProvider
|
||||
return LocalFilesystemProvider
|
||||
}
|
||||
|
||||
// Name returns the Provider's unique name
|
||||
func (p FilesystemProvider) Name() string {
|
||||
switch p {
|
||||
case LocalFilesystemProvider:
|
||||
return "osfs"
|
||||
case S3FilesystemProvider:
|
||||
return "s3fs"
|
||||
case GCSFilesystemProvider:
|
||||
return "gcsfs"
|
||||
case AzureBlobFilesystemProvider:
|
||||
return "azblobfs"
|
||||
case CryptedFilesystemProvider:
|
||||
return "cryptfs"
|
||||
case SFTPFilesystemProvider:
|
||||
return "sftpfs"
|
||||
}
|
||||
return "" // let's not claim to be
|
||||
}
|
||||
|
||||
// ShortInfo returns a human readable, short description for the given FilesystemProvider
|
||||
func (p FilesystemProvider) ShortInfo() string {
|
||||
switch p {
|
||||
case LocalFilesystemProvider:
|
||||
return "Local"
|
||||
case S3FilesystemProvider:
|
||||
return "AWS S3 (Compatible)"
|
||||
case GCSFilesystemProvider:
|
||||
return "Google Cloud Storage"
|
||||
case AzureBlobFilesystemProvider:
|
||||
return "Azure Blob Storage"
|
||||
case CryptedFilesystemProvider:
|
||||
return "Local encrypted"
|
||||
case SFTPFilesystemProvider:
|
||||
return "SFTP"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// ListProviders returns a list of available FilesystemProviders.
|
||||
func ListProviders() []FilesystemProvider {
|
||||
return []FilesystemProvider{
|
||||
LocalFilesystemProvider, S3FilesystemProvider,
|
||||
GCSFilesystemProvider, AzureBlobFilesystemProvider,
|
||||
CryptedFilesystemProvider, SFTPFilesystemProvider,
|
||||
}
|
||||
}
|
||||
|
||||
// BaseS3FsConfig defines the base configuration for S3 based filesystems
|
||||
type BaseS3FsConfig struct {
|
||||
Bucket string `json:"bucket,omitempty"`
|
||||
// KeyPrefix is similar to a chroot directory for local filesystem.
|
||||
// If specified then the SFTP user will only see objects that starts
|
||||
// with this prefix and so you can restrict access to a specific
|
||||
// folder. The prefix, if not empty, must not start with "/" and must
|
||||
// end with "/".
|
||||
// If empty the whole bucket contents will be available
|
||||
KeyPrefix string `json:"key_prefix,omitempty"`
|
||||
Region string `json:"region,omitempty"`
|
||||
AccessKey string `json:"access_key,omitempty"`
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
StorageClass string `json:"storage_class,omitempty"`
|
||||
// The canned ACL to apply to uploaded objects. Leave empty to use the default ACL.
|
||||
// For more information and available ACLs, see here:
|
||||
// https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl
|
||||
ACL string `json:"acl,omitempty"`
|
||||
// The buffer size (in MB) to use for multipart uploads. The minimum allowed part size is 5MB,
|
||||
// and if this value is set to zero, the default value (5MB) for the AWS SDK will be used.
|
||||
// The minimum allowed value is 5.
|
||||
// Please note that if the upload bandwidth between the SFTP client and SFTPGo is greater than
|
||||
// the upload bandwidth between SFTPGo and S3 then the SFTP client have to wait for the upload
|
||||
// of the last parts to S3 after it ends the file upload to SFTPGo, and it may time out.
|
||||
// Keep this in mind if you customize these parameters.
|
||||
UploadPartSize int64 `json:"upload_part_size,omitempty"`
|
||||
// How many parts are uploaded in parallel
|
||||
UploadConcurrency int `json:"upload_concurrency,omitempty"`
|
||||
// The buffer size (in MB) to use for multipart downloads. The minimum allowed part size is 5MB,
|
||||
// and if this value is set to zero, the default value (5MB) for the AWS SDK will be used.
|
||||
// The minimum allowed value is 5. Ignored for partial downloads.
|
||||
DownloadPartSize int64 `json:"download_part_size,omitempty"`
|
||||
// How many parts are downloaded in parallel. Ignored for partial downloads.
|
||||
DownloadConcurrency int `json:"download_concurrency,omitempty"`
|
||||
// DownloadPartMaxTime defines the maximum time allowed, in seconds, to download a single chunk (5MB).
|
||||
// 0 means no timeout. Ignored for partial downloads.
|
||||
DownloadPartMaxTime int `json:"download_part_max_time,omitempty"`
|
||||
// Set this to `true` to force the request to use path-style addressing,
|
||||
// i.e., `http://s3.amazonaws.com/BUCKET/KEY`. By default, the S3 client
|
||||
// will use virtual hosted bucket addressing when possible
|
||||
// (`http://BUCKET.s3.amazonaws.com/KEY`)
|
||||
ForcePathStyle bool `json:"force_path_style,omitempty"`
|
||||
}
|
||||
|
||||
// S3FsConfig defines the base configuration for S3 based filesystems
|
||||
type S3FsConfig struct {
|
||||
BaseS3FsConfig
|
||||
AccessSecret kms.BaseSecret `json:"access_secret,omitempty"`
|
||||
}
|
||||
|
||||
// BaseGCSFsConfig defines the base configuration for Google Cloud Storage based filesystems
|
||||
type BaseGCSFsConfig struct {
|
||||
Bucket string `json:"bucket,omitempty"`
|
||||
// KeyPrefix is similar to a chroot directory for local filesystem.
|
||||
// If specified then the SFTP user will only see objects that starts
|
||||
// with this prefix and so you can restrict access to a specific
|
||||
// folder. The prefix, if not empty, must not start with "/" and must
|
||||
// end with "/".
|
||||
// If empty the whole bucket contents will be available
|
||||
KeyPrefix string `json:"key_prefix,omitempty"`
|
||||
CredentialFile string `json:"-"`
|
||||
// 0 explicit, 1 automatic
|
||||
AutomaticCredentials int `json:"automatic_credentials,omitempty"`
|
||||
StorageClass string `json:"storage_class,omitempty"`
|
||||
// The ACL to apply to uploaded objects. Leave empty to use the default ACL.
|
||||
// For more information and available ACLs, refer to the JSON API here:
|
||||
// https://cloud.google.com/storage/docs/access-control/lists#predefined-acl
|
||||
ACL string `json:"acl,omitempty"`
|
||||
}
|
||||
|
||||
// GCSFsConfig defines the configuration for Google Cloud Storage based filesystems
|
||||
type GCSFsConfig struct {
|
||||
BaseGCSFsConfig
|
||||
Credentials kms.BaseSecret `json:"credentials,omitempty"`
|
||||
}
|
||||
|
||||
// BaseAzBlobFsConfig defines the base configuration for Azure Blob Storage based filesystem
|
||||
type BaseAzBlobFsConfig struct {
|
||||
Container string `json:"container,omitempty"`
|
||||
// Storage Account Name, leave blank to use SAS URL
|
||||
AccountName string `json:"account_name,omitempty"`
|
||||
// Optional endpoint. Default is "blob.core.windows.net".
|
||||
// If you use the emulator the endpoint must include the protocol,
|
||||
// for example "http://127.0.0.1:10000"
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
// KeyPrefix is similar to a chroot directory for local filesystem.
|
||||
// If specified then the SFTPGo user will only see objects that starts
|
||||
// with this prefix and so you can restrict access to a specific
|
||||
// folder. The prefix, if not empty, must not start with "/" and must
|
||||
// end with "/".
|
||||
// If empty the whole bucket contents will be available
|
||||
KeyPrefix string `json:"key_prefix,omitempty"`
|
||||
// The buffer size (in MB) to use for multipart uploads.
|
||||
// If this value is set to zero, the default value (1MB) for the Azure SDK will be used.
|
||||
// Please note that if the upload bandwidth between the SFTPGo client and SFTPGo server is
|
||||
// greater than the upload bandwidth between SFTPGo and Azure then the SFTP client have
|
||||
// to wait for the upload of the last parts to Azure after it ends the file upload to SFTPGo,
|
||||
// and it may time out.
|
||||
// Keep this in mind if you customize these parameters.
|
||||
UploadPartSize int64 `json:"upload_part_size,omitempty"`
|
||||
// How many parts are uploaded in parallel
|
||||
UploadConcurrency int `json:"upload_concurrency,omitempty"`
|
||||
// Set to true if you use an Azure emulator such as Azurite
|
||||
UseEmulator bool `json:"use_emulator,omitempty"`
|
||||
// Blob Access Tier
|
||||
AccessTier string `json:"access_tier,omitempty"`
|
||||
}
|
||||
|
||||
// AzBlobFsConfig defines the configuration for Azure Blob Storage based filesystem
|
||||
type AzBlobFsConfig struct {
|
||||
BaseAzBlobFsConfig
|
||||
// Storage Account Key leave blank to use SAS URL.
|
||||
// The access key is stored encrypted based on the kms configuration
|
||||
AccountKey kms.BaseSecret `json:"account_key,omitempty"`
|
||||
// Shared access signature URL, leave blank if using account/key
|
||||
SASURL kms.BaseSecret `json:"sas_url,omitempty"`
|
||||
}
|
||||
|
||||
// CryptFsConfig defines the configuration to store local files as encrypted
|
||||
type CryptFsConfig struct {
|
||||
Passphrase kms.BaseSecret `json:"passphrase,omitempty"`
|
||||
}
|
||||
|
||||
// BaseSFTPFsConfig defines the base configuration for SFTP based filesystem
|
||||
type BaseSFTPFsConfig struct {
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
Fingerprints []string `json:"fingerprints,omitempty"`
|
||||
// Prefix is the path prefix to strip from SFTP resource paths.
|
||||
Prefix string `json:"prefix,omitempty"`
|
||||
// Concurrent reads are safe to use and disabling them will degrade performance.
|
||||
// Some servers automatically delete files once they are downloaded.
|
||||
// Using concurrent reads is problematic with such servers.
|
||||
DisableCouncurrentReads bool `json:"disable_concurrent_reads,omitempty"`
|
||||
// The buffer size (in MB) to use for transfers.
|
||||
// Buffering could improve performance for high latency networks.
|
||||
// With buffering enabled upload resume is not supported and a file
|
||||
// cannot be opened for both reading and writing at the same time
|
||||
// 0 means disabled.
|
||||
BufferSize int64 `json:"buffer_size,omitempty"`
|
||||
}
|
||||
|
||||
// SFTPFsConfig defines the configuration for SFTP based filesystem
|
||||
type SFTPFsConfig struct {
|
||||
BaseSFTPFsConfig
|
||||
Password kms.BaseSecret `json:"password,omitempty"`
|
||||
PrivateKey kms.BaseSecret `json:"private_key,omitempty"`
|
||||
}
|
||||
|
||||
// Filesystem defines filesystem details
|
||||
type Filesystem struct {
|
||||
Provider FilesystemProvider `json:"provider"`
|
||||
S3Config S3FsConfig `json:"s3config,omitempty"`
|
||||
GCSConfig GCSFsConfig `json:"gcsconfig,omitempty"`
|
||||
AzBlobConfig AzBlobFsConfig `json:"azblobconfig,omitempty"`
|
||||
CryptConfig CryptFsConfig `json:"cryptconfig,omitempty"`
|
||||
SFTPConfig SFTPFsConfig `json:"sftpconfig,omitempty"`
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package sdk
|
||||
|
||||
// BaseVirtualFolder defines the path for the virtual folder and the used quota limits.
|
||||
// The same folder can be shared among multiple users and each user can have different
|
||||
// quota limits or a different virtual path.
|
||||
type BaseVirtualFolder struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
MappedPath string `json:"mapped_path,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
UsedQuotaSize int64 `json:"used_quota_size"`
|
||||
// Used quota as number of files
|
||||
UsedQuotaFiles int `json:"used_quota_files"`
|
||||
// Last quota update as unix timestamp in milliseconds
|
||||
LastQuotaUpdate int64 `json:"last_quota_update"`
|
||||
// list of usernames associated with this virtual folder
|
||||
Users []string `json:"users,omitempty"`
|
||||
// Filesystem configuration details
|
||||
FsConfig Filesystem `json:"filesystem"`
|
||||
}
|
||||
|
||||
// VirtualFolder defines a mapping between an SFTPGo exposed virtual path and a
|
||||
// filesystem path outside the user home directory.
|
||||
// The specified paths must be absolute and the virtual path cannot be "/",
|
||||
// it must be a sub directory. The parent directory for the specified virtual
|
||||
// path must exist. SFTPGo will, by default, try to automatically create any missing
|
||||
// parent directory for the configured virtual folders at user login.
|
||||
type VirtualFolder struct {
|
||||
BaseVirtualFolder
|
||||
VirtualPath string `json:"virtual_path"`
|
||||
// Maximum size allowed as bytes. 0 means unlimited, -1 included in user quota
|
||||
QuotaSize int64 `json:"quota_size"`
|
||||
// Maximum number of files allowed. 0 means unlimited, -1 included in user quota
|
||||
QuotaFiles int `json:"quota_files"`
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
// Package kms provides Key Management Services support
|
||||
package kms
|
||||
|
||||
// SecretStatus defines the statuses of a Secret object
|
||||
type SecretStatus = string
|
||||
|
||||
const (
|
||||
// SecretStatusPlain means the secret is in plain text and must be encrypted
|
||||
SecretStatusPlain SecretStatus = "Plain"
|
||||
// SecretStatusAES256GCM means the secret is encrypted using AES-256-GCM
|
||||
SecretStatusAES256GCM SecretStatus = "AES-256-GCM"
|
||||
// SecretStatusSecretBox means the secret is encrypted using a locally provided symmetric key
|
||||
SecretStatusSecretBox SecretStatus = "Secretbox"
|
||||
// SecretStatusGCP means we use keys from Google Cloud Platform’s Key Management Service
|
||||
// (GCP KMS) to keep information secret
|
||||
SecretStatusGCP SecretStatus = "GCP"
|
||||
// SecretStatusAWS means we use customer master keys from Amazon Web Service’s
|
||||
// Key Management Service (AWS KMS) to keep information secret
|
||||
SecretStatusAWS SecretStatus = "AWS"
|
||||
// SecretStatusVaultTransit means we use the transit secrets engine in Vault
|
||||
// to keep information secret
|
||||
SecretStatusVaultTransit SecretStatus = "VaultTransit"
|
||||
// SecretStatusAzureKeyVault means we use Azure KeyVault to keep information secret
|
||||
SecretStatusAzureKeyVault SecretStatus = "AzureKeyVault"
|
||||
// SecretStatusRedacted means the secret is redacted
|
||||
SecretStatusRedacted SecretStatus = "Redacted"
|
||||
)
|
||||
|
||||
// Scheme defines the supported URL scheme
|
||||
type Scheme = string
|
||||
|
||||
// supported URL schemes
|
||||
const (
|
||||
SchemeLocal Scheme = "local"
|
||||
SchemeBuiltin Scheme = "builtin"
|
||||
SchemeAWS Scheme = "awskms"
|
||||
SchemeGCP Scheme = "gcpkms"
|
||||
SchemeVaultTransit Scheme = "hashivault"
|
||||
SchemeAzureKeyVault Scheme = "azurekeyvault"
|
||||
)
|
||||
|
||||
// BaseSecret defines the base struct shared among all the secret providers
|
||||
type BaseSecret struct {
|
||||
Status SecretStatus `json:"status,omitempty"`
|
||||
Payload string `json:"payload,omitempty"`
|
||||
Key string `json:"key,omitempty"`
|
||||
AdditionalData string `json:"additional_data,omitempty"`
|
||||
// 1 means encrypted using a master key
|
||||
Mode int `json:"mode,omitempty"`
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
// Package auth defines the implementation for authentication plugins.
|
||||
// Authentication plugins allow to authenticate external users
|
||||
package auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/go-plugin"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/auth/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
// PluginName defines the name for a notifier plugin
|
||||
PluginName = "auth"
|
||||
)
|
||||
|
||||
// Handshake is a common handshake that is shared by plugin and host.
|
||||
var Handshake = plugin.HandshakeConfig{
|
||||
ProtocolVersion: 1,
|
||||
MagicCookieKey: "SFTPGO_PLUGIN_AUTH",
|
||||
MagicCookieValue: "d1ed507d-d2be-4a38-a460-6fe0b2cc7efc",
|
||||
}
|
||||
|
||||
// PluginMap is the map of plugins we can dispense.
|
||||
var PluginMap = map[string]plugin.Plugin{
|
||||
PluginName: &Plugin{},
|
||||
}
|
||||
|
||||
// Authenticator defines the interface for authentication plugins
|
||||
type Authenticator interface {
|
||||
CheckUserAndPass(username, password, ip, protocol string, userAsJSON []byte) ([]byte, error)
|
||||
CheckUserAndTLSCert(username, tlsCert, ip, protocol string, userAsJSON []byte) ([]byte, error)
|
||||
CheckUserAndPublicKey(username, pubKey, ip, protocol string, userAsJSON []byte) ([]byte, error)
|
||||
CheckUserAndKeyboardInteractive(username, ip, protocol string, userAsJSON []byte) ([]byte, error)
|
||||
SendKeyboardAuthRequest(requestID, username, password, ip string, answers, questions []string, step int32) (string, []string, []bool, int, int, error)
|
||||
}
|
||||
|
||||
// Plugin defines the implementation to serve/connect to an authe plugin
|
||||
type Plugin struct {
|
||||
plugin.Plugin
|
||||
Impl Authenticator
|
||||
}
|
||||
|
||||
// GRPCServer defines the GRPC server implementation for this plugin
|
||||
func (p *Plugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error {
|
||||
proto.RegisterAuthServer(s, &GRPCServer{
|
||||
Impl: p.Impl,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// GRPCClient defines the GRPC client implementation for this plugin
|
||||
func (p *Plugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) {
|
||||
return &GRPCClient{
|
||||
client: proto.NewAuthClient(c),
|
||||
}, nil
|
||||
}
|
|
@ -1,165 +0,0 @@
|
|||
package auth
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/auth/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
rpcTimeout = 20 * time.Second
|
||||
)
|
||||
|
||||
// GRPCClient is an implementation of Authenticator interface that talks over RPC.
|
||||
type GRPCClient struct {
|
||||
client proto.AuthClient
|
||||
}
|
||||
|
||||
// CheckUserAndPass implements the Authenticator interface
|
||||
func (c *GRPCClient) CheckUserAndPass(username, password, ip, protocol string, userAsJSON []byte) ([]byte, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
resp, err := c.client.CheckUserAndPass(ctx, &proto.CheckUserAndPassRequest{
|
||||
Username: username,
|
||||
Password: password,
|
||||
Ip: ip,
|
||||
Protocol: protocol,
|
||||
User: userAsJSON,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp.User, nil
|
||||
}
|
||||
|
||||
// CheckUserAndTLSCert implements the Authenticator interface
|
||||
func (c *GRPCClient) CheckUserAndTLSCert(username, tlsCert, ip, protocol string, userAsJSON []byte) ([]byte, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
resp, err := c.client.CheckUserAndTLSCert(ctx, &proto.CheckUserAndTLSCertRequest{
|
||||
Username: username,
|
||||
TlsCert: tlsCert,
|
||||
Ip: ip,
|
||||
Protocol: protocol,
|
||||
User: userAsJSON,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp.User, nil
|
||||
}
|
||||
|
||||
// CheckUserAndPublicKey implements the Authenticator interface
|
||||
func (c *GRPCClient) CheckUserAndPublicKey(username, pubKey, ip, protocol string, userAsJSON []byte) ([]byte, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
resp, err := c.client.CheckUserAndPublicKey(ctx, &proto.CheckUserAndPublicKeyRequest{
|
||||
Username: username,
|
||||
PubKey: pubKey,
|
||||
Ip: ip,
|
||||
Protocol: protocol,
|
||||
User: userAsJSON,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp.User, nil
|
||||
}
|
||||
|
||||
// CheckUserAndKeyboardInteractive implements the Authenticator interface
|
||||
func (c *GRPCClient) CheckUserAndKeyboardInteractive(username, ip, protocol string, userAsJSON []byte) ([]byte, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
resp, err := c.client.CheckUserAndKeyboardInteractive(ctx, &proto.CheckUserAndKeyboardInteractiveRequest{
|
||||
Username: username,
|
||||
Ip: ip,
|
||||
Protocol: protocol,
|
||||
User: userAsJSON,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp.User, nil
|
||||
}
|
||||
|
||||
// SendKeyboardAuthRequest implements the Authenticator interface
|
||||
func (c *GRPCClient) SendKeyboardAuthRequest(requestID, username, password, ip string, answers, questions []string, step int32) (string, []string, []bool, int, int, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
resp, err := c.client.SendKeyboardAuthRequest(ctx, &proto.KeyboardAuthRequest{
|
||||
RequestID: requestID,
|
||||
Username: username,
|
||||
Password: password,
|
||||
Ip: ip,
|
||||
Answers: answers,
|
||||
Questions: questions,
|
||||
Step: step,
|
||||
})
|
||||
if err != nil {
|
||||
return "", nil, nil, 0, 0, err
|
||||
}
|
||||
return resp.Instructions, resp.Questions, resp.Echos, int(resp.AuthResult), int(resp.CheckPassword), err
|
||||
}
|
||||
|
||||
// GRPCServer defines the gRPC server that GRPCClient talks to.
|
||||
type GRPCServer struct {
|
||||
Impl Authenticator
|
||||
}
|
||||
|
||||
// CheckUserAndPass implements the server side check user and password method
|
||||
func (s *GRPCServer) CheckUserAndPass(ctx context.Context, req *proto.CheckUserAndPassRequest) (*proto.AuthResponse, error) {
|
||||
user, err := s.Impl.CheckUserAndPass(req.Username, req.Password, req.Ip, req.Protocol, req.User)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &proto.AuthResponse{User: user}, nil
|
||||
}
|
||||
|
||||
// CheckUserAndTLSCert implements the server side check user and tls certificate method
|
||||
func (s *GRPCServer) CheckUserAndTLSCert(ctx context.Context, req *proto.CheckUserAndTLSCertRequest) (*proto.AuthResponse, error) {
|
||||
user, err := s.Impl.CheckUserAndTLSCert(req.Username, req.TlsCert, req.Ip, req.Protocol, req.User)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &proto.AuthResponse{User: user}, nil
|
||||
}
|
||||
|
||||
// CheckUserAndPublicKey implements the server side check user and public key method
|
||||
func (s *GRPCServer) CheckUserAndPublicKey(ctx context.Context, req *proto.CheckUserAndPublicKeyRequest) (*proto.AuthResponse, error) {
|
||||
user, err := s.Impl.CheckUserAndPublicKey(req.Username, req.PubKey, req.Ip, req.Protocol, req.User)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &proto.AuthResponse{User: user}, nil
|
||||
}
|
||||
|
||||
// CheckUserAndKeyboardInteractive implements the server side check user and keyboard interactive method
|
||||
func (s *GRPCServer) CheckUserAndKeyboardInteractive(ctx context.Context, req *proto.CheckUserAndKeyboardInteractiveRequest) (*proto.AuthResponse, error) {
|
||||
user, err := s.Impl.CheckUserAndKeyboardInteractive(req.Username, req.Ip, req.Protocol, req.User)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &proto.AuthResponse{User: user}, nil
|
||||
}
|
||||
|
||||
// SendKeyboardAuthRequest implements the server side method to send a keyboard interactive authentication request
|
||||
func (s *GRPCServer) SendKeyboardAuthRequest(ctx context.Context, req *proto.KeyboardAuthRequest) (*proto.KeyboardAuthResponse, error) {
|
||||
instructions, questions, echos, authResult, checkPwd, err := s.Impl.SendKeyboardAuthRequest(req.RequestID, req.Username,
|
||||
req.Password, req.Ip, req.Answers, req.Questions, req.Step)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &proto.KeyboardAuthResponse{
|
||||
Instructions: instructions,
|
||||
Questions: questions,
|
||||
Echos: echos,
|
||||
AuthResult: int32(authResult),
|
||||
CheckPassword: int32(checkPwd),
|
||||
}, nil
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,65 +0,0 @@
|
|||
syntax = "proto3";
|
||||
package proto;
|
||||
|
||||
option go_package = "sdk/plugin/auth/proto";
|
||||
|
||||
message CheckUserAndPassRequest {
|
||||
string username = 1;
|
||||
string password = 2;
|
||||
string ip = 3;
|
||||
string protocol = 4;
|
||||
bytes user = 5; // SFTPGo user JSON serialized
|
||||
}
|
||||
|
||||
message CheckUserAndTLSCertRequest {
|
||||
string username = 1;
|
||||
string tlsCert = 2; // tls certificate pem encoded
|
||||
string ip = 3;
|
||||
string protocol = 4;
|
||||
bytes user = 5; // SFTPGo user JSON serialized
|
||||
}
|
||||
|
||||
message CheckUserAndPublicKeyRequest {
|
||||
string username = 1;
|
||||
string pubKey = 2;
|
||||
string ip = 3;
|
||||
string protocol = 4;
|
||||
bytes user = 5; // SFTPGo user JSON serialized
|
||||
}
|
||||
|
||||
message CheckUserAndKeyboardInteractiveRequest {
|
||||
string username = 1;
|
||||
string ip = 2;
|
||||
string protocol = 3;
|
||||
bytes user = 4; // SFTPGo user JSON serialized
|
||||
}
|
||||
|
||||
message KeyboardAuthRequest {
|
||||
string requestID = 1;
|
||||
string username = 2;
|
||||
string password = 3;
|
||||
string ip = 4;
|
||||
repeated string answers = 5;
|
||||
repeated string questions = 6;
|
||||
int32 step = 7;
|
||||
}
|
||||
|
||||
message KeyboardAuthResponse {
|
||||
string instructions = 1;
|
||||
repeated string questions = 2;
|
||||
repeated bool echos = 3;
|
||||
int32 auth_result = 4;
|
||||
int32 check_password = 5;
|
||||
}
|
||||
|
||||
message AuthResponse {
|
||||
bytes user = 1; // SFTPGo user JSON serialized
|
||||
}
|
||||
|
||||
service Auth {
|
||||
rpc CheckUserAndPass(CheckUserAndPassRequest) returns (AuthResponse);
|
||||
rpc CheckUserAndTLSCert(CheckUserAndTLSCertRequest) returns (AuthResponse);
|
||||
rpc CheckUserAndPublicKey(CheckUserAndPublicKeyRequest) returns (AuthResponse);
|
||||
rpc CheckUserAndKeyboardInteractive(CheckUserAndKeyboardInteractiveRequest) returns (AuthResponse);
|
||||
rpc SendKeyboardAuthRequest(KeyboardAuthRequest) returns (KeyboardAuthResponse);
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
// Package eventsearcher defines the implementation for events search plugins.
|
||||
// Events search plugins allow to search for filesystem and provider events.
|
||||
package eventsearcher
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/go-plugin"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/eventsearcher/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
// PluginName defines the name for an events search plugin
|
||||
PluginName = "eventsearcher"
|
||||
)
|
||||
|
||||
// Handshake is a common handshake that is shared by plugin and host.
|
||||
var Handshake = plugin.HandshakeConfig{
|
||||
ProtocolVersion: 1,
|
||||
MagicCookieKey: "SFTPGO_PLUGIN_EVENTSEARCHER",
|
||||
MagicCookieValue: "2b523805-0279-471c-895e-6c0d39002ca4",
|
||||
}
|
||||
|
||||
// PluginMap is the map of plugins we can dispense.
|
||||
var PluginMap = map[string]plugin.Plugin{
|
||||
PluginName: &Plugin{},
|
||||
}
|
||||
|
||||
// CommonSearchParams defines common parameters for both filesystem and provider search
|
||||
type CommonSearchParams struct {
|
||||
StartTimestamp int64
|
||||
EndTimestamp int64
|
||||
Actions []string
|
||||
Username string
|
||||
IP string
|
||||
InstanceIDs []string
|
||||
ExcludeIDs []string
|
||||
Limit int
|
||||
Order int
|
||||
}
|
||||
|
||||
// FsEventSearch defines the fields for a filesystem event search
|
||||
type FsEventSearch struct {
|
||||
CommonSearchParams
|
||||
SSHCmd string
|
||||
Protocols []string
|
||||
Statuses []int32
|
||||
FsProvider int
|
||||
Bucket string
|
||||
Endpoint string
|
||||
}
|
||||
|
||||
// ProviderEventSearch defines the fields for a provider event search
|
||||
type ProviderEventSearch struct {
|
||||
CommonSearchParams
|
||||
ObjectName string
|
||||
ObjectTypes []string
|
||||
}
|
||||
|
||||
// Searcher defines the interface for events search plugins
|
||||
type Searcher interface {
|
||||
SearchFsEvents(searchFilters *FsEventSearch) ([]byte, []string, []string, error)
|
||||
SearchProviderEvents(searchFilters *ProviderEventSearch) ([]byte, []string, []string, error)
|
||||
}
|
||||
|
||||
// Plugin defines the implementation to serve/connect to a event search plugin
|
||||
type Plugin struct {
|
||||
plugin.Plugin
|
||||
Impl Searcher
|
||||
}
|
||||
|
||||
// GRPCServer defines the GRPC server implementation for this plugin
|
||||
func (p *Plugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error {
|
||||
proto.RegisterSearcherServer(s, &GRPCServer{
|
||||
Impl: p.Impl,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// GRPCClient defines the GRPC client implementation for this plugin
|
||||
func (p *Plugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) {
|
||||
return &GRPCClient{
|
||||
client: proto.NewSearcherClient(c),
|
||||
}, nil
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
package eventsearcher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/eventsearcher/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
rpcTimeout = 20 * time.Second
|
||||
)
|
||||
|
||||
// GRPCClient is an implementation of Notifier interface that talks over RPC.
|
||||
type GRPCClient struct {
|
||||
client proto.SearcherClient
|
||||
}
|
||||
|
||||
// SearchFsEvents implements the Searcher interface
|
||||
func (c *GRPCClient) SearchFsEvents(searchFilters *FsEventSearch) ([]byte, []string, []string, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
resp, err := c.client.SearchFsEvents(ctx, &proto.FsEventsFilter{
|
||||
StartTimestamp: searchFilters.StartTimestamp,
|
||||
EndTimestamp: searchFilters.EndTimestamp,
|
||||
Actions: searchFilters.Actions,
|
||||
Username: searchFilters.Username,
|
||||
Ip: searchFilters.IP,
|
||||
SshCmd: searchFilters.SSHCmd,
|
||||
Protocols: searchFilters.Protocols,
|
||||
InstanceIds: searchFilters.InstanceIDs,
|
||||
Statuses: searchFilters.Statuses,
|
||||
Limit: int32(searchFilters.Limit),
|
||||
ExcludeIds: searchFilters.ExcludeIDs,
|
||||
FsProvider: int32(searchFilters.FsProvider),
|
||||
Bucket: searchFilters.Bucket,
|
||||
Endpoint: searchFilters.Endpoint,
|
||||
Order: proto.FsEventsFilter_Order(searchFilters.Order),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
return resp.Data, resp.SameTsAtStart, resp.SameTsAtEnd, nil
|
||||
}
|
||||
|
||||
// SearchProviderEvents implements the Searcher interface
|
||||
func (c *GRPCClient) SearchProviderEvents(searchFilters *ProviderEventSearch) ([]byte, []string, []string, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
resp, err := c.client.SearchProviderEvents(ctx, &proto.ProviderEventsFilter{
|
||||
StartTimestamp: searchFilters.StartTimestamp,
|
||||
EndTimestamp: searchFilters.EndTimestamp,
|
||||
Actions: searchFilters.Actions,
|
||||
Username: searchFilters.Username,
|
||||
Ip: searchFilters.IP,
|
||||
ObjectTypes: searchFilters.ObjectTypes,
|
||||
ObjectName: searchFilters.ObjectName,
|
||||
InstanceIds: searchFilters.InstanceIDs,
|
||||
Limit: int32(searchFilters.Limit),
|
||||
ExcludeIds: searchFilters.ExcludeIDs,
|
||||
Order: proto.ProviderEventsFilter_Order(searchFilters.Order),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
return resp.Data, resp.SameTsAtStart, resp.SameTsAtEnd, nil
|
||||
}
|
||||
|
||||
// GRPCServer defines the gRPC server that GRPCClient talks to.
|
||||
type GRPCServer struct {
|
||||
Impl Searcher
|
||||
}
|
||||
|
||||
// SearchFsEvents implements the server side fs events search method
|
||||
func (s *GRPCServer) SearchFsEvents(ctx context.Context, req *proto.FsEventsFilter) (*proto.SearchResponse, error) {
|
||||
responseData, sameTsAtStart, sameTsAtEnd, err := s.Impl.SearchFsEvents(&FsEventSearch{
|
||||
CommonSearchParams: CommonSearchParams{
|
||||
StartTimestamp: req.StartTimestamp,
|
||||
EndTimestamp: req.EndTimestamp,
|
||||
Actions: req.Actions,
|
||||
Username: req.Username,
|
||||
IP: req.Ip,
|
||||
InstanceIDs: req.InstanceIds,
|
||||
Limit: int(req.Limit),
|
||||
ExcludeIDs: req.ExcludeIds,
|
||||
Order: int(req.Order),
|
||||
},
|
||||
|
||||
SSHCmd: req.SshCmd,
|
||||
Protocols: req.Protocols,
|
||||
Statuses: req.Statuses,
|
||||
FsProvider: int(req.FsProvider),
|
||||
Bucket: req.Bucket,
|
||||
Endpoint: req.Endpoint,
|
||||
})
|
||||
|
||||
return &proto.SearchResponse{
|
||||
Data: responseData,
|
||||
SameTsAtStart: sameTsAtStart,
|
||||
SameTsAtEnd: sameTsAtEnd,
|
||||
}, err
|
||||
}
|
||||
|
||||
// SearchProviderEvents implement the server side provider events search method
|
||||
func (s *GRPCServer) SearchProviderEvents(ctx context.Context, req *proto.ProviderEventsFilter) (*proto.SearchResponse, error) {
|
||||
responseData, sameTsAtStart, sameTsAtEnd, err := s.Impl.SearchProviderEvents(&ProviderEventSearch{
|
||||
CommonSearchParams: CommonSearchParams{
|
||||
StartTimestamp: req.StartTimestamp,
|
||||
EndTimestamp: req.EndTimestamp,
|
||||
Actions: req.Actions,
|
||||
Username: req.Username,
|
||||
IP: req.Ip,
|
||||
InstanceIDs: req.InstanceIds,
|
||||
Limit: int(req.Limit),
|
||||
ExcludeIDs: req.ExcludeIds,
|
||||
Order: int(req.Order),
|
||||
},
|
||||
ObjectTypes: req.ObjectTypes,
|
||||
ObjectName: req.ObjectName,
|
||||
})
|
||||
|
||||
return &proto.SearchResponse{
|
||||
Data: responseData,
|
||||
SameTsAtStart: sameTsAtStart,
|
||||
SameTsAtEnd: sameTsAtEnd,
|
||||
}, err
|
||||
}
|
|
@ -1,766 +0,0 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.19.1
|
||||
// source: eventsearcher/proto/search.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type FsEventsFilter_Order int32
|
||||
|
||||
const (
|
||||
FsEventsFilter_DESC FsEventsFilter_Order = 0
|
||||
FsEventsFilter_ASC FsEventsFilter_Order = 1
|
||||
)
|
||||
|
||||
// Enum value maps for FsEventsFilter_Order.
|
||||
var (
|
||||
FsEventsFilter_Order_name = map[int32]string{
|
||||
0: "DESC",
|
||||
1: "ASC",
|
||||
}
|
||||
FsEventsFilter_Order_value = map[string]int32{
|
||||
"DESC": 0,
|
||||
"ASC": 1,
|
||||
}
|
||||
)
|
||||
|
||||
func (x FsEventsFilter_Order) Enum() *FsEventsFilter_Order {
|
||||
p := new(FsEventsFilter_Order)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x FsEventsFilter_Order) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (FsEventsFilter_Order) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_eventsearcher_proto_search_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (FsEventsFilter_Order) Type() protoreflect.EnumType {
|
||||
return &file_eventsearcher_proto_search_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x FsEventsFilter_Order) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FsEventsFilter_Order.Descriptor instead.
|
||||
func (FsEventsFilter_Order) EnumDescriptor() ([]byte, []int) {
|
||||
return file_eventsearcher_proto_search_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
type ProviderEventsFilter_Order int32
|
||||
|
||||
const (
|
||||
ProviderEventsFilter_DESC ProviderEventsFilter_Order = 0
|
||||
ProviderEventsFilter_ASC ProviderEventsFilter_Order = 1
|
||||
)
|
||||
|
||||
// Enum value maps for ProviderEventsFilter_Order.
|
||||
var (
|
||||
ProviderEventsFilter_Order_name = map[int32]string{
|
||||
0: "DESC",
|
||||
1: "ASC",
|
||||
}
|
||||
ProviderEventsFilter_Order_value = map[string]int32{
|
||||
"DESC": 0,
|
||||
"ASC": 1,
|
||||
}
|
||||
)
|
||||
|
||||
func (x ProviderEventsFilter_Order) Enum() *ProviderEventsFilter_Order {
|
||||
p := new(ProviderEventsFilter_Order)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x ProviderEventsFilter_Order) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (ProviderEventsFilter_Order) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_eventsearcher_proto_search_proto_enumTypes[1].Descriptor()
|
||||
}
|
||||
|
||||
func (ProviderEventsFilter_Order) Type() protoreflect.EnumType {
|
||||
return &file_eventsearcher_proto_search_proto_enumTypes[1]
|
||||
}
|
||||
|
||||
func (x ProviderEventsFilter_Order) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ProviderEventsFilter_Order.Descriptor instead.
|
||||
func (ProviderEventsFilter_Order) EnumDescriptor() ([]byte, []int) {
|
||||
return file_eventsearcher_proto_search_proto_rawDescGZIP(), []int{1, 0}
|
||||
}
|
||||
|
||||
type FsEventsFilter struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
StartTimestamp int64 `protobuf:"varint,1,opt,name=start_timestamp,json=startTimestamp,proto3" json:"start_timestamp,omitempty"`
|
||||
EndTimestamp int64 `protobuf:"varint,2,opt,name=end_timestamp,json=endTimestamp,proto3" json:"end_timestamp,omitempty"`
|
||||
Actions []string `protobuf:"bytes,3,rep,name=actions,proto3" json:"actions,omitempty"`
|
||||
Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"`
|
||||
Ip string `protobuf:"bytes,5,opt,name=ip,proto3" json:"ip,omitempty"`
|
||||
SshCmd string `protobuf:"bytes,6,opt,name=ssh_cmd,json=sshCmd,proto3" json:"ssh_cmd,omitempty"`
|
||||
Protocols []string `protobuf:"bytes,7,rep,name=protocols,proto3" json:"protocols,omitempty"`
|
||||
Statuses []int32 `protobuf:"varint,8,rep,packed,name=statuses,proto3" json:"statuses,omitempty"`
|
||||
InstanceIds []string `protobuf:"bytes,9,rep,name=instance_ids,json=instanceIds,proto3" json:"instance_ids,omitempty"`
|
||||
Limit int32 `protobuf:"varint,10,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||
ExcludeIds []string `protobuf:"bytes,11,rep,name=exclude_ids,json=excludeIds,proto3" json:"exclude_ids,omitempty"`
|
||||
FsProvider int32 `protobuf:"varint,12,opt,name=fs_provider,json=fsProvider,proto3" json:"fs_provider,omitempty"`
|
||||
Bucket string `protobuf:"bytes,13,opt,name=bucket,proto3" json:"bucket,omitempty"`
|
||||
Endpoint string `protobuf:"bytes,14,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
|
||||
Order FsEventsFilter_Order `protobuf:"varint,15,opt,name=order,proto3,enum=proto.FsEventsFilter_Order" json:"order,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) Reset() {
|
||||
*x = FsEventsFilter{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_eventsearcher_proto_search_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FsEventsFilter) ProtoMessage() {}
|
||||
|
||||
func (x *FsEventsFilter) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_eventsearcher_proto_search_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FsEventsFilter.ProtoReflect.Descriptor instead.
|
||||
func (*FsEventsFilter) Descriptor() ([]byte, []int) {
|
||||
return file_eventsearcher_proto_search_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetStartTimestamp() int64 {
|
||||
if x != nil {
|
||||
return x.StartTimestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetEndTimestamp() int64 {
|
||||
if x != nil {
|
||||
return x.EndTimestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetActions() []string {
|
||||
if x != nil {
|
||||
return x.Actions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetIp() string {
|
||||
if x != nil {
|
||||
return x.Ip
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetSshCmd() string {
|
||||
if x != nil {
|
||||
return x.SshCmd
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetProtocols() []string {
|
||||
if x != nil {
|
||||
return x.Protocols
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetStatuses() []int32 {
|
||||
if x != nil {
|
||||
return x.Statuses
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetInstanceIds() []string {
|
||||
if x != nil {
|
||||
return x.InstanceIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetLimit() int32 {
|
||||
if x != nil {
|
||||
return x.Limit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetExcludeIds() []string {
|
||||
if x != nil {
|
||||
return x.ExcludeIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetFsProvider() int32 {
|
||||
if x != nil {
|
||||
return x.FsProvider
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetBucket() string {
|
||||
if x != nil {
|
||||
return x.Bucket
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetEndpoint() string {
|
||||
if x != nil {
|
||||
return x.Endpoint
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEventsFilter) GetOrder() FsEventsFilter_Order {
|
||||
if x != nil {
|
||||
return x.Order
|
||||
}
|
||||
return FsEventsFilter_DESC
|
||||
}
|
||||
|
||||
type ProviderEventsFilter struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
StartTimestamp int64 `protobuf:"varint,1,opt,name=start_timestamp,json=startTimestamp,proto3" json:"start_timestamp,omitempty"`
|
||||
EndTimestamp int64 `protobuf:"varint,2,opt,name=end_timestamp,json=endTimestamp,proto3" json:"end_timestamp,omitempty"`
|
||||
Actions []string `protobuf:"bytes,3,rep,name=actions,proto3" json:"actions,omitempty"`
|
||||
Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"`
|
||||
Ip string `protobuf:"bytes,5,opt,name=ip,proto3" json:"ip,omitempty"`
|
||||
ObjectTypes []string `protobuf:"bytes,6,rep,name=object_types,json=objectTypes,proto3" json:"object_types,omitempty"`
|
||||
ObjectName string `protobuf:"bytes,7,opt,name=object_name,json=objectName,proto3" json:"object_name,omitempty"`
|
||||
InstanceIds []string `protobuf:"bytes,8,rep,name=instance_ids,json=instanceIds,proto3" json:"instance_ids,omitempty"`
|
||||
Limit int32 `protobuf:"varint,9,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||
ExcludeIds []string `protobuf:"bytes,10,rep,name=exclude_ids,json=excludeIds,proto3" json:"exclude_ids,omitempty"`
|
||||
Order ProviderEventsFilter_Order `protobuf:"varint,11,opt,name=order,proto3,enum=proto.ProviderEventsFilter_Order" json:"order,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ProviderEventsFilter) Reset() {
|
||||
*x = ProviderEventsFilter{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_eventsearcher_proto_search_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ProviderEventsFilter) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ProviderEventsFilter) ProtoMessage() {}
|
||||
|
||||
func (x *ProviderEventsFilter) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_eventsearcher_proto_search_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ProviderEventsFilter.ProtoReflect.Descriptor instead.
|
||||
func (*ProviderEventsFilter) Descriptor() ([]byte, []int) {
|
||||
return file_eventsearcher_proto_search_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ProviderEventsFilter) GetStartTimestamp() int64 {
|
||||
if x != nil {
|
||||
return x.StartTimestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ProviderEventsFilter) GetEndTimestamp() int64 {
|
||||
if x != nil {
|
||||
return x.EndTimestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ProviderEventsFilter) GetActions() []string {
|
||||
if x != nil {
|
||||
return x.Actions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ProviderEventsFilter) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ProviderEventsFilter) GetIp() string {
|
||||
if x != nil {
|
||||
return x.Ip
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ProviderEventsFilter) GetObjectTypes() []string {
|
||||
if x != nil {
|
||||
return x.ObjectTypes
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ProviderEventsFilter) GetObjectName() string {
|
||||
if x != nil {
|
||||
return x.ObjectName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ProviderEventsFilter) GetInstanceIds() []string {
|
||||
if x != nil {
|
||||
return x.InstanceIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ProviderEventsFilter) GetLimit() int32 {
|
||||
if x != nil {
|
||||
return x.Limit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ProviderEventsFilter) GetExcludeIds() []string {
|
||||
if x != nil {
|
||||
return x.ExcludeIds
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ProviderEventsFilter) GetOrder() ProviderEventsFilter_Order {
|
||||
if x != nil {
|
||||
return x.Order
|
||||
}
|
||||
return ProviderEventsFilter_DESC
|
||||
}
|
||||
|
||||
type SearchResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // JSON serialized response to return
|
||||
SameTsAtStart []string `protobuf:"bytes,2,rep,name=same_ts_at_start,json=sameTsAtStart,proto3" json:"same_ts_at_start,omitempty"`
|
||||
SameTsAtEnd []string `protobuf:"bytes,3,rep,name=same_ts_at_end,json=sameTsAtEnd,proto3" json:"same_ts_at_end,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SearchResponse) Reset() {
|
||||
*x = SearchResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_eventsearcher_proto_search_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SearchResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SearchResponse) ProtoMessage() {}
|
||||
|
||||
func (x *SearchResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_eventsearcher_proto_search_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SearchResponse.ProtoReflect.Descriptor instead.
|
||||
func (*SearchResponse) Descriptor() ([]byte, []int) {
|
||||
return file_eventsearcher_proto_search_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *SearchResponse) GetData() []byte {
|
||||
if x != nil {
|
||||
return x.Data
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SearchResponse) GetSameTsAtStart() []string {
|
||||
if x != nil {
|
||||
return x.SameTsAtStart
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *SearchResponse) GetSameTsAtEnd() []string {
|
||||
if x != nil {
|
||||
return x.SameTsAtEnd
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_eventsearcher_proto_search_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_eventsearcher_proto_search_proto_rawDesc = []byte{
|
||||
0x0a, 0x20, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x2f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf5, 0x03, 0x0a, 0x0e, 0x46, 0x73,
|
||||
0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f,
|
||||
0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65,
|
||||
0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x65, 0x6e,
|
||||
0x64, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x63,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x61, 0x63, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70,
|
||||
0x12, 0x17, 0x0a, 0x07, 0x73, 0x73, 0x68, 0x5f, 0x63, 0x6d, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x06, 0x73, 0x73, 0x68, 0x43, 0x6d, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x73, 0x74, 0x61, 0x74, 0x75,
|
||||
0x73, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f,
|
||||
0x69, 0x64, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61,
|
||||
0x6e, 0x63, 0x65, 0x49, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18,
|
||||
0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1f, 0x0a, 0x0b,
|
||||
0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x0b, 0x20, 0x03, 0x28,
|
||||
0x09, 0x52, 0x0a, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x49, 0x64, 0x73, 0x12, 0x1f, 0x0a,
|
||||
0x0b, 0x66, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x0a, 0x66, 0x73, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x16,
|
||||
0x0a, 0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
|
||||
0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69,
|
||||
0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69,
|
||||
0x6e, 0x74, 0x12, 0x31, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x0f, 0x20, 0x01, 0x28,
|
||||
0x0e, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x73, 0x45, 0x76, 0x65, 0x6e,
|
||||
0x74, 0x73, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05,
|
||||
0x6f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x1a, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x08,
|
||||
0x0a, 0x04, 0x44, 0x45, 0x53, 0x43, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x53, 0x43, 0x10,
|
||||
0x01, 0x22, 0x9d, 0x03, 0x0a, 0x14, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x45, 0x76,
|
||||
0x65, 0x6e, 0x74, 0x73, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x74,
|
||||
0x61, 0x72, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x03, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74,
|
||||
0x61, 0x6d, 0x70, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73,
|
||||
0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x65, 0x6e, 0x64, 0x54,
|
||||
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x61, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e,
|
||||
0x0a, 0x02, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x21,
|
||||
0x0a, 0x0c, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x18, 0x06,
|
||||
0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65,
|
||||
0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4e, 0x61,
|
||||
0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x69,
|
||||
0x64, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e,
|
||||
0x63, 0x65, 0x49, 0x64, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x09,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x1f, 0x0a, 0x0b, 0x65,
|
||||
0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09,
|
||||
0x52, 0x0a, 0x65, 0x78, 0x63, 0x6c, 0x75, 0x64, 0x65, 0x49, 0x64, 0x73, 0x12, 0x37, 0x0a, 0x05,
|
||||
0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x45, 0x76, 0x65, 0x6e,
|
||||
0x74, 0x73, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05,
|
||||
0x6f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x1a, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x08,
|
||||
0x0a, 0x04, 0x44, 0x45, 0x53, 0x43, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x53, 0x43, 0x10,
|
||||
0x01, 0x22, 0x72, 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x27, 0x0a, 0x10, 0x73, 0x61, 0x6d, 0x65, 0x5f,
|
||||
0x74, 0x73, 0x5f, 0x61, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28,
|
||||
0x09, 0x52, 0x0d, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x73, 0x41, 0x74, 0x53, 0x74, 0x61, 0x72, 0x74,
|
||||
0x12, 0x23, 0x0a, 0x0e, 0x73, 0x61, 0x6d, 0x65, 0x5f, 0x74, 0x73, 0x5f, 0x61, 0x74, 0x5f, 0x65,
|
||||
0x6e, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x61, 0x6d, 0x65, 0x54, 0x73,
|
||||
0x41, 0x74, 0x45, 0x6e, 0x64, 0x32, 0x96, 0x01, 0x0a, 0x08, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
|
||||
0x65, 0x72, 0x12, 0x3e, 0x0a, 0x0e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x46, 0x73, 0x45, 0x76,
|
||||
0x65, 0x6e, 0x74, 0x73, 0x12, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x73, 0x45,
|
||||
0x76, 0x65, 0x6e, 0x74, 0x73, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x1a, 0x15, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x4a, 0x0a, 0x14, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x50, 0x72, 0x6f, 0x76,
|
||||
0x69, 0x64, 0x65, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74,
|
||||
0x73, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
|
||||
0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x20,
|
||||
0x5a, 0x1e, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x65, 0x76, 0x65,
|
||||
0x6e, 0x74, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_eventsearcher_proto_search_proto_rawDescOnce sync.Once
|
||||
file_eventsearcher_proto_search_proto_rawDescData = file_eventsearcher_proto_search_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_eventsearcher_proto_search_proto_rawDescGZIP() []byte {
|
||||
file_eventsearcher_proto_search_proto_rawDescOnce.Do(func() {
|
||||
file_eventsearcher_proto_search_proto_rawDescData = protoimpl.X.CompressGZIP(file_eventsearcher_proto_search_proto_rawDescData)
|
||||
})
|
||||
return file_eventsearcher_proto_search_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_eventsearcher_proto_search_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||
var file_eventsearcher_proto_search_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_eventsearcher_proto_search_proto_goTypes = []interface{}{
|
||||
(FsEventsFilter_Order)(0), // 0: proto.FsEventsFilter.Order
|
||||
(ProviderEventsFilter_Order)(0), // 1: proto.ProviderEventsFilter.Order
|
||||
(*FsEventsFilter)(nil), // 2: proto.FsEventsFilter
|
||||
(*ProviderEventsFilter)(nil), // 3: proto.ProviderEventsFilter
|
||||
(*SearchResponse)(nil), // 4: proto.SearchResponse
|
||||
}
|
||||
var file_eventsearcher_proto_search_proto_depIdxs = []int32{
|
||||
0, // 0: proto.FsEventsFilter.order:type_name -> proto.FsEventsFilter.Order
|
||||
1, // 1: proto.ProviderEventsFilter.order:type_name -> proto.ProviderEventsFilter.Order
|
||||
2, // 2: proto.Searcher.SearchFsEvents:input_type -> proto.FsEventsFilter
|
||||
3, // 3: proto.Searcher.SearchProviderEvents:input_type -> proto.ProviderEventsFilter
|
||||
4, // 4: proto.Searcher.SearchFsEvents:output_type -> proto.SearchResponse
|
||||
4, // 5: proto.Searcher.SearchProviderEvents:output_type -> proto.SearchResponse
|
||||
4, // [4:6] is the sub-list for method output_type
|
||||
2, // [2:4] is the sub-list for method input_type
|
||||
2, // [2:2] is the sub-list for extension type_name
|
||||
2, // [2:2] is the sub-list for extension extendee
|
||||
0, // [0:2] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_eventsearcher_proto_search_proto_init() }
|
||||
func file_eventsearcher_proto_search_proto_init() {
|
||||
if File_eventsearcher_proto_search_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_eventsearcher_proto_search_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FsEventsFilter); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_eventsearcher_proto_search_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ProviderEventsFilter); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_eventsearcher_proto_search_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SearchResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_eventsearcher_proto_search_proto_rawDesc,
|
||||
NumEnums: 2,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_eventsearcher_proto_search_proto_goTypes,
|
||||
DependencyIndexes: file_eventsearcher_proto_search_proto_depIdxs,
|
||||
EnumInfos: file_eventsearcher_proto_search_proto_enumTypes,
|
||||
MessageInfos: file_eventsearcher_proto_search_proto_msgTypes,
|
||||
}.Build()
|
||||
File_eventsearcher_proto_search_proto = out.File
|
||||
file_eventsearcher_proto_search_proto_rawDesc = nil
|
||||
file_eventsearcher_proto_search_proto_goTypes = nil
|
||||
file_eventsearcher_proto_search_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// SearcherClient is the client API for Searcher service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type SearcherClient interface {
|
||||
SearchFsEvents(ctx context.Context, in *FsEventsFilter, opts ...grpc.CallOption) (*SearchResponse, error)
|
||||
SearchProviderEvents(ctx context.Context, in *ProviderEventsFilter, opts ...grpc.CallOption) (*SearchResponse, error)
|
||||
}
|
||||
|
||||
type searcherClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewSearcherClient(cc grpc.ClientConnInterface) SearcherClient {
|
||||
return &searcherClient{cc}
|
||||
}
|
||||
|
||||
func (c *searcherClient) SearchFsEvents(ctx context.Context, in *FsEventsFilter, opts ...grpc.CallOption) (*SearchResponse, error) {
|
||||
out := new(SearchResponse)
|
||||
err := c.cc.Invoke(ctx, "/proto.Searcher/SearchFsEvents", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *searcherClient) SearchProviderEvents(ctx context.Context, in *ProviderEventsFilter, opts ...grpc.CallOption) (*SearchResponse, error) {
|
||||
out := new(SearchResponse)
|
||||
err := c.cc.Invoke(ctx, "/proto.Searcher/SearchProviderEvents", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// SearcherServer is the server API for Searcher service.
|
||||
type SearcherServer interface {
|
||||
SearchFsEvents(context.Context, *FsEventsFilter) (*SearchResponse, error)
|
||||
SearchProviderEvents(context.Context, *ProviderEventsFilter) (*SearchResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedSearcherServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedSearcherServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedSearcherServer) SearchFsEvents(context.Context, *FsEventsFilter) (*SearchResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SearchFsEvents not implemented")
|
||||
}
|
||||
func (*UnimplementedSearcherServer) SearchProviderEvents(context.Context, *ProviderEventsFilter) (*SearchResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SearchProviderEvents not implemented")
|
||||
}
|
||||
|
||||
func RegisterSearcherServer(s *grpc.Server, srv SearcherServer) {
|
||||
s.RegisterService(&_Searcher_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Searcher_SearchFsEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FsEventsFilter)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SearcherServer).SearchFsEvents(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/proto.Searcher/SearchFsEvents",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SearcherServer).SearchFsEvents(ctx, req.(*FsEventsFilter))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Searcher_SearchProviderEvents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ProviderEventsFilter)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SearcherServer).SearchProviderEvents(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/proto.Searcher/SearchProviderEvents",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SearcherServer).SearchProviderEvents(ctx, req.(*ProviderEventsFilter))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Searcher_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "proto.Searcher",
|
||||
HandlerType: (*SearcherServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "SearchFsEvents",
|
||||
Handler: _Searcher_SearchFsEvents_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SearchProviderEvents",
|
||||
Handler: _Searcher_SearchProviderEvents_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "eventsearcher/proto/search.proto",
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
syntax = "proto3";
|
||||
package proto;
|
||||
|
||||
option go_package = "sdk/plugin/eventsearcher/proto";
|
||||
|
||||
message FsEventsFilter {
|
||||
int64 start_timestamp = 1;
|
||||
int64 end_timestamp = 2;
|
||||
repeated string actions = 3;
|
||||
string username = 4;
|
||||
string ip = 5;
|
||||
string ssh_cmd = 6;
|
||||
repeated string protocols = 7;
|
||||
repeated int32 statuses = 8;
|
||||
repeated string instance_ids = 9;
|
||||
int32 limit = 10;
|
||||
repeated string exclude_ids = 11;
|
||||
int32 fs_provider = 12;
|
||||
string bucket = 13;
|
||||
string endpoint = 14;
|
||||
enum Order {
|
||||
DESC = 0;
|
||||
ASC = 1;
|
||||
}
|
||||
Order order = 15;
|
||||
}
|
||||
|
||||
message ProviderEventsFilter {
|
||||
int64 start_timestamp = 1;
|
||||
int64 end_timestamp = 2;
|
||||
repeated string actions = 3;
|
||||
string username = 4;
|
||||
string ip = 5;
|
||||
repeated string object_types = 6;
|
||||
string object_name = 7;
|
||||
repeated string instance_ids = 8;
|
||||
int32 limit = 9;
|
||||
repeated string exclude_ids = 10;
|
||||
enum Order {
|
||||
DESC = 0;
|
||||
ASC = 1;
|
||||
}
|
||||
Order order = 11;
|
||||
}
|
||||
|
||||
message SearchResponse {
|
||||
bytes data = 1; // JSON serialized response to return
|
||||
repeated string same_ts_at_start = 2;
|
||||
repeated string same_ts_at_end = 3;
|
||||
}
|
||||
|
||||
service Searcher {
|
||||
rpc SearchFsEvents(FsEventsFilter) returns (SearchResponse);
|
||||
rpc SearchProviderEvents(ProviderEventsFilter) returns (SearchResponse);
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
package kms
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/kms/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
rpcTimeout = 20 * time.Second
|
||||
)
|
||||
|
||||
// GRPCClient is an implementation of KMS interface that talks over RPC.
|
||||
type GRPCClient struct {
|
||||
client proto.KMSClient
|
||||
}
|
||||
|
||||
// Encrypt implements the KMSService interface
|
||||
func (c *GRPCClient) Encrypt(payload, additionalData, URL, masterKey string) (string, string, int32, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
resp, err := c.client.Encrypt(ctx, &proto.EncryptRequest{
|
||||
Payload: payload,
|
||||
AdditionalData: additionalData,
|
||||
Url: URL,
|
||||
MasterKey: masterKey,
|
||||
})
|
||||
if err != nil {
|
||||
return "", "", 0, err
|
||||
}
|
||||
return resp.Payload, resp.Key, resp.Mode, nil
|
||||
}
|
||||
|
||||
// Decrypt implements the KMSService interface
|
||||
func (c *GRPCClient) Decrypt(payload, key, additionalData string, mode int, URL, masterKey string) (string, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
resp, err := c.client.Decrypt(ctx, &proto.DecryptRequest{
|
||||
Payload: payload,
|
||||
Key: key,
|
||||
AdditionalData: additionalData,
|
||||
Mode: int32(mode),
|
||||
Url: URL,
|
||||
MasterKey: masterKey,
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return resp.Payload, nil
|
||||
}
|
||||
|
||||
// GRPCServer defines the gRPC server that GRPCClient talks to.
|
||||
type GRPCServer struct {
|
||||
Impl Service
|
||||
}
|
||||
|
||||
// Encrypt implements the serve side encrypt method
|
||||
func (s *GRPCServer) Encrypt(ctx context.Context, req *proto.EncryptRequest) (*proto.EncryptResponse, error) {
|
||||
payload, key, mode, err := s.Impl.Encrypt(req.Payload, req.AdditionalData, req.Url, req.MasterKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &proto.EncryptResponse{
|
||||
Payload: payload,
|
||||
Key: key,
|
||||
Mode: mode,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Decrypt implements the serve side decrypt method
|
||||
func (s *GRPCServer) Decrypt(ctx context.Context, req *proto.DecryptRequest) (*proto.DecryptResponse, error) {
|
||||
payload, err := s.Impl.Decrypt(req.Payload, req.Key, req.AdditionalData, int(req.Mode), req.Url, req.MasterKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &proto.DecryptResponse{
|
||||
Payload: payload,
|
||||
}, nil
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
// Package kms defines the implementation for kms plugins.
|
||||
// KMS plugins allow to encrypt/decrypt sensitive data.
|
||||
package kms
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/go-plugin"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/kms/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
// PluginName defines the name for a kms plugin
|
||||
PluginName = "kms"
|
||||
)
|
||||
|
||||
// Handshake is a common handshake that is shared by plugin and host.
|
||||
var Handshake = plugin.HandshakeConfig{
|
||||
ProtocolVersion: 1,
|
||||
MagicCookieKey: "SFTPGO_PLUGIN_KMS",
|
||||
MagicCookieValue: "223e3571-7ed2-4b96-b4b3-c7eb87d7ca1d",
|
||||
}
|
||||
|
||||
// PluginMap is the map of plugins we can dispense.
|
||||
var PluginMap = map[string]plugin.Plugin{
|
||||
PluginName: &Plugin{},
|
||||
}
|
||||
|
||||
// Service defines the interface for kms plugins
|
||||
type Service interface {
|
||||
Encrypt(payload, additionalData, URL, masterKey string) (string, string, int32, error)
|
||||
Decrypt(payload, key, additionalData string, mode int, URL, masterKey string) (string, error)
|
||||
}
|
||||
|
||||
// Plugin defines the implementation to serve/connect to a notifier plugin
|
||||
type Plugin struct {
|
||||
plugin.Plugin
|
||||
Impl Service
|
||||
}
|
||||
|
||||
// GRPCServer defines the GRPC server implementation for this plugin
|
||||
func (p *Plugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error {
|
||||
proto.RegisterKMSServer(s, &GRPCServer{
|
||||
Impl: p.Impl,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// GRPCClient defines the GRPC client implementation for this plugin
|
||||
func (p *Plugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) {
|
||||
return &GRPCClient{
|
||||
client: proto.NewKMSClient(c),
|
||||
}, nil
|
||||
}
|
|
@ -1,559 +0,0 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.17.3
|
||||
// source: kms/proto/kms.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type EncryptRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Payload string `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
AdditionalData string `protobuf:"bytes,2,opt,name=additional_data,json=additionalData,proto3" json:"additional_data,omitempty"`
|
||||
Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
|
||||
MasterKey string `protobuf:"bytes,4,opt,name=master_key,json=masterKey,proto3" json:"master_key,omitempty"`
|
||||
}
|
||||
|
||||
func (x *EncryptRequest) Reset() {
|
||||
*x = EncryptRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_kms_proto_kms_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *EncryptRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*EncryptRequest) ProtoMessage() {}
|
||||
|
||||
func (x *EncryptRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_kms_proto_kms_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use EncryptRequest.ProtoReflect.Descriptor instead.
|
||||
func (*EncryptRequest) Descriptor() ([]byte, []int) {
|
||||
return file_kms_proto_kms_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *EncryptRequest) GetPayload() string {
|
||||
if x != nil {
|
||||
return x.Payload
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EncryptRequest) GetAdditionalData() string {
|
||||
if x != nil {
|
||||
return x.AdditionalData
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EncryptRequest) GetUrl() string {
|
||||
if x != nil {
|
||||
return x.Url
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EncryptRequest) GetMasterKey() string {
|
||||
if x != nil {
|
||||
return x.MasterKey
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type EncryptResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Payload string `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
|
||||
Mode int32 `protobuf:"varint,3,opt,name=mode,proto3" json:"mode,omitempty"`
|
||||
}
|
||||
|
||||
func (x *EncryptResponse) Reset() {
|
||||
*x = EncryptResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_kms_proto_kms_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *EncryptResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*EncryptResponse) ProtoMessage() {}
|
||||
|
||||
func (x *EncryptResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_kms_proto_kms_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use EncryptResponse.ProtoReflect.Descriptor instead.
|
||||
func (*EncryptResponse) Descriptor() ([]byte, []int) {
|
||||
return file_kms_proto_kms_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *EncryptResponse) GetPayload() string {
|
||||
if x != nil {
|
||||
return x.Payload
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EncryptResponse) GetKey() string {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *EncryptResponse) GetMode() int32 {
|
||||
if x != nil {
|
||||
return x.Mode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DecryptRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Payload string `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
|
||||
AdditionalData string `protobuf:"bytes,3,opt,name=additional_data,json=additionalData,proto3" json:"additional_data,omitempty"`
|
||||
Mode int32 `protobuf:"varint,4,opt,name=mode,proto3" json:"mode,omitempty"`
|
||||
Url string `protobuf:"bytes,5,opt,name=url,proto3" json:"url,omitempty"`
|
||||
MasterKey string `protobuf:"bytes,6,opt,name=master_key,json=masterKey,proto3" json:"master_key,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DecryptRequest) Reset() {
|
||||
*x = DecryptRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_kms_proto_kms_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DecryptRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DecryptRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DecryptRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_kms_proto_kms_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DecryptRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DecryptRequest) Descriptor() ([]byte, []int) {
|
||||
return file_kms_proto_kms_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *DecryptRequest) GetPayload() string {
|
||||
if x != nil {
|
||||
return x.Payload
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DecryptRequest) GetKey() string {
|
||||
if x != nil {
|
||||
return x.Key
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DecryptRequest) GetAdditionalData() string {
|
||||
if x != nil {
|
||||
return x.AdditionalData
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DecryptRequest) GetMode() int32 {
|
||||
if x != nil {
|
||||
return x.Mode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DecryptRequest) GetUrl() string {
|
||||
if x != nil {
|
||||
return x.Url
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DecryptRequest) GetMasterKey() string {
|
||||
if x != nil {
|
||||
return x.MasterKey
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type DecryptResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Payload string `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DecryptResponse) Reset() {
|
||||
*x = DecryptResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_kms_proto_kms_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DecryptResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DecryptResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DecryptResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_kms_proto_kms_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DecryptResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DecryptResponse) Descriptor() ([]byte, []int) {
|
||||
return file_kms_proto_kms_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *DecryptResponse) GetPayload() string {
|
||||
if x != nil {
|
||||
return x.Payload
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_kms_proto_kms_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_kms_proto_kms_proto_rawDesc = []byte{
|
||||
0x0a, 0x13, 0x6b, 0x6d, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6b, 0x6d, 0x73, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x84, 0x01, 0x0a,
|
||||
0x0e, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x64, 0x64,
|
||||
0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0e, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x44, 0x61,
|
||||
0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x03, 0x75, 0x72, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6b,
|
||||
0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72,
|
||||
0x4b, 0x65, 0x79, 0x22, 0x51, 0x0a, 0x0f, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0xaa, 0x01, 0x0a, 0x0e, 0x44, 0x65, 0x63, 0x72, 0x79,
|
||||
0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79,
|
||||
0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c,
|
||||
0x6f, 0x61, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x61, 0x6c, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e,
|
||||
0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x61, 0x6c, 0x44, 0x61, 0x74, 0x61, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x6d, 0x6f,
|
||||
0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x03, 0x75, 0x72, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6b,
|
||||
0x65, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72,
|
||||
0x4b, 0x65, 0x79, 0x22, 0x2b, 0x0a, 0x0f, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64,
|
||||
0x32, 0x79, 0x0a, 0x03, 0x4b, 0x4d, 0x53, 0x12, 0x38, 0x0a, 0x07, 0x45, 0x6e, 0x63, 0x72, 0x79,
|
||||
0x70, 0x74, 0x12, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x45, 0x6e, 0x63, 0x72, 0x79,
|
||||
0x70, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2e, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x12, 0x38, 0x0a, 0x07, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x12, 0x15, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x63, 0x72, 0x79, 0x70, 0x74, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x65, 0x63, 0x72,
|
||||
0x79, 0x70, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x16, 0x5a, 0x14, 0x73,
|
||||
0x64, 0x6b, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x6b, 0x6d, 0x73, 0x2f, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_kms_proto_kms_proto_rawDescOnce sync.Once
|
||||
file_kms_proto_kms_proto_rawDescData = file_kms_proto_kms_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_kms_proto_kms_proto_rawDescGZIP() []byte {
|
||||
file_kms_proto_kms_proto_rawDescOnce.Do(func() {
|
||||
file_kms_proto_kms_proto_rawDescData = protoimpl.X.CompressGZIP(file_kms_proto_kms_proto_rawDescData)
|
||||
})
|
||||
return file_kms_proto_kms_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_kms_proto_kms_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_kms_proto_kms_proto_goTypes = []interface{}{
|
||||
(*EncryptRequest)(nil), // 0: proto.EncryptRequest
|
||||
(*EncryptResponse)(nil), // 1: proto.EncryptResponse
|
||||
(*DecryptRequest)(nil), // 2: proto.DecryptRequest
|
||||
(*DecryptResponse)(nil), // 3: proto.DecryptResponse
|
||||
}
|
||||
var file_kms_proto_kms_proto_depIdxs = []int32{
|
||||
0, // 0: proto.KMS.Encrypt:input_type -> proto.EncryptRequest
|
||||
2, // 1: proto.KMS.Decrypt:input_type -> proto.DecryptRequest
|
||||
1, // 2: proto.KMS.Encrypt:output_type -> proto.EncryptResponse
|
||||
3, // 3: proto.KMS.Decrypt:output_type -> proto.DecryptResponse
|
||||
2, // [2:4] is the sub-list for method output_type
|
||||
0, // [0:2] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_kms_proto_kms_proto_init() }
|
||||
func file_kms_proto_kms_proto_init() {
|
||||
if File_kms_proto_kms_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_kms_proto_kms_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*EncryptRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_kms_proto_kms_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*EncryptResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_kms_proto_kms_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DecryptRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_kms_proto_kms_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DecryptResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_kms_proto_kms_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_kms_proto_kms_proto_goTypes,
|
||||
DependencyIndexes: file_kms_proto_kms_proto_depIdxs,
|
||||
MessageInfos: file_kms_proto_kms_proto_msgTypes,
|
||||
}.Build()
|
||||
File_kms_proto_kms_proto = out.File
|
||||
file_kms_proto_kms_proto_rawDesc = nil
|
||||
file_kms_proto_kms_proto_goTypes = nil
|
||||
file_kms_proto_kms_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// KMSClient is the client API for KMS service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type KMSClient interface {
|
||||
Encrypt(ctx context.Context, in *EncryptRequest, opts ...grpc.CallOption) (*EncryptResponse, error)
|
||||
Decrypt(ctx context.Context, in *DecryptRequest, opts ...grpc.CallOption) (*DecryptResponse, error)
|
||||
}
|
||||
|
||||
type kMSClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewKMSClient(cc grpc.ClientConnInterface) KMSClient {
|
||||
return &kMSClient{cc}
|
||||
}
|
||||
|
||||
func (c *kMSClient) Encrypt(ctx context.Context, in *EncryptRequest, opts ...grpc.CallOption) (*EncryptResponse, error) {
|
||||
out := new(EncryptResponse)
|
||||
err := c.cc.Invoke(ctx, "/proto.KMS/Encrypt", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *kMSClient) Decrypt(ctx context.Context, in *DecryptRequest, opts ...grpc.CallOption) (*DecryptResponse, error) {
|
||||
out := new(DecryptResponse)
|
||||
err := c.cc.Invoke(ctx, "/proto.KMS/Decrypt", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// KMSServer is the server API for KMS service.
|
||||
type KMSServer interface {
|
||||
Encrypt(context.Context, *EncryptRequest) (*EncryptResponse, error)
|
||||
Decrypt(context.Context, *DecryptRequest) (*DecryptResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedKMSServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedKMSServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedKMSServer) Encrypt(context.Context, *EncryptRequest) (*EncryptResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Encrypt not implemented")
|
||||
}
|
||||
func (*UnimplementedKMSServer) Decrypt(context.Context, *DecryptRequest) (*DecryptResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Decrypt not implemented")
|
||||
}
|
||||
|
||||
func RegisterKMSServer(s *grpc.Server, srv KMSServer) {
|
||||
s.RegisterService(&_KMS_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _KMS_Encrypt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(EncryptRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(KMSServer).Encrypt(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/proto.KMS/Encrypt",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(KMSServer).Encrypt(ctx, req.(*EncryptRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _KMS_Decrypt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DecryptRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(KMSServer).Decrypt(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/proto.KMS/Decrypt",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(KMSServer).Decrypt(ctx, req.(*DecryptRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _KMS_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "proto.KMS",
|
||||
HandlerType: (*KMSServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Encrypt",
|
||||
Handler: _KMS_Encrypt_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Decrypt",
|
||||
Handler: _KMS_Decrypt_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "kms/proto/kms.proto",
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
syntax = "proto3";
|
||||
package proto;
|
||||
|
||||
option go_package = "sdk/plugin/kms/proto";
|
||||
|
||||
message EncryptRequest {
|
||||
string payload = 1;
|
||||
string additional_data = 2;
|
||||
string url = 3;
|
||||
string master_key = 4;
|
||||
}
|
||||
|
||||
message EncryptResponse {
|
||||
string payload = 1;
|
||||
string key = 2;
|
||||
int32 mode = 3;
|
||||
}
|
||||
|
||||
message DecryptRequest {
|
||||
string payload = 1;
|
||||
string key = 2;
|
||||
string additional_data = 3;
|
||||
int32 mode = 4;
|
||||
string url = 5;
|
||||
string master_key = 6;
|
||||
}
|
||||
|
||||
message DecryptResponse {
|
||||
string payload = 1;
|
||||
}
|
||||
|
||||
service KMS {
|
||||
rpc Encrypt(EncryptRequest) returns (EncryptResponse);
|
||||
rpc Decrypt(DecryptRequest) returns (DecryptResponse);
|
||||
}
|
|
@ -1,160 +0,0 @@
|
|||
package metadata
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/metadata/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
rpcTimeout = 20 * time.Second
|
||||
)
|
||||
|
||||
// GRPCClient is an implementation of Metadater interface that talks over RPC.
|
||||
type GRPCClient struct {
|
||||
client proto.MetadataClient
|
||||
}
|
||||
|
||||
// SetModificationTime implements the Metadater interface
|
||||
func (c *GRPCClient) SetModificationTime(storageID, objectPath string, mTime int64) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
_, err := c.client.SetModificationTime(ctx, &proto.SetModificationTimeRequest{
|
||||
StorageId: storageID,
|
||||
ObjectPath: objectPath,
|
||||
ModificationTime: mTime,
|
||||
})
|
||||
|
||||
return c.checkError(err)
|
||||
}
|
||||
|
||||
// GetModificationTime implements the Metadater interface
|
||||
func (c *GRPCClient) GetModificationTime(storageID, objectPath string) (int64, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
resp, err := c.client.GetModificationTime(ctx, &proto.GetModificationTimeRequest{
|
||||
StorageId: storageID,
|
||||
ObjectPath: objectPath,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return 0, c.checkError(err)
|
||||
}
|
||||
|
||||
return resp.ModificationTime, nil
|
||||
}
|
||||
|
||||
// GetModificationTimes implements the Metadater interface
|
||||
func (c *GRPCClient) GetModificationTimes(storageID, objectPath string) (map[string]int64, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout*4)
|
||||
defer cancel()
|
||||
|
||||
resp, err := c.client.GetModificationTimes(ctx, &proto.GetModificationTimesRequest{
|
||||
StorageId: storageID,
|
||||
FolderPath: objectPath,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, c.checkError(err)
|
||||
}
|
||||
|
||||
return resp.Pairs, nil
|
||||
}
|
||||
|
||||
// RemoveMetadata implements the Metadater interface
|
||||
func (c *GRPCClient) RemoveMetadata(storageID, objectPath string) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
_, err := c.client.RemoveMetadata(ctx, &proto.RemoveMetadataRequest{
|
||||
StorageId: storageID,
|
||||
ObjectPath: objectPath,
|
||||
})
|
||||
|
||||
return c.checkError(err)
|
||||
}
|
||||
|
||||
// GetFolders implements the Metadater interface
|
||||
func (c *GRPCClient) GetFolders(storageID string, limit int, from string) ([]string, error) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
resp, err := c.client.GetFolders(ctx, &proto.GetFoldersRequest{
|
||||
StorageId: storageID,
|
||||
Limit: int32(limit),
|
||||
From: from,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, c.checkError(err)
|
||||
}
|
||||
return resp.Folders, nil
|
||||
}
|
||||
|
||||
func (c *GRPCClient) checkError(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
if s, ok := status.FromError(err); ok {
|
||||
if s.Code() == codes.NotFound {
|
||||
return ErrNoSuchObject
|
||||
}
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// GRPCServer defines the gRPC server that GRPCClient talks to.
|
||||
type GRPCServer struct {
|
||||
Impl Metadater
|
||||
}
|
||||
|
||||
// SetModificationTime implements the server side set modification time method
|
||||
func (s *GRPCServer) SetModificationTime(ctx context.Context, req *proto.SetModificationTimeRequest) (*emptypb.Empty, error) {
|
||||
err := s.Impl.SetModificationTime(req.StorageId, req.ObjectPath, req.ModificationTime)
|
||||
|
||||
return &emptypb.Empty{}, err
|
||||
}
|
||||
|
||||
// GetModificationTime implements the server side get modification time method
|
||||
func (s *GRPCServer) GetModificationTime(ctx context.Context, req *proto.GetModificationTimeRequest) (
|
||||
*proto.GetModificationTimeResponse, error,
|
||||
) {
|
||||
mTime, err := s.Impl.GetModificationTime(req.StorageId, req.ObjectPath)
|
||||
|
||||
return &proto.GetModificationTimeResponse{
|
||||
ModificationTime: mTime,
|
||||
}, err
|
||||
}
|
||||
|
||||
// GetModificationTimes implements the server side get modification times method
|
||||
func (s *GRPCServer) GetModificationTimes(ctx context.Context, req *proto.GetModificationTimesRequest) (
|
||||
*proto.GetModificationTimesResponse, error,
|
||||
) {
|
||||
res, err := s.Impl.GetModificationTimes(req.StorageId, req.FolderPath)
|
||||
|
||||
return &proto.GetModificationTimesResponse{
|
||||
Pairs: res,
|
||||
}, err
|
||||
}
|
||||
|
||||
// RemoveMetadata implements the server side remove metadata method
|
||||
func (s *GRPCServer) RemoveMetadata(ctx context.Context, req *proto.RemoveMetadataRequest) (*emptypb.Empty, error) {
|
||||
err := s.Impl.RemoveMetadata(req.StorageId, req.ObjectPath)
|
||||
|
||||
return &emptypb.Empty{}, err
|
||||
}
|
||||
|
||||
// GetFolders implements the server side get folders method
|
||||
func (s *GRPCServer) GetFolders(ctx context.Context, req *proto.GetFoldersRequest) (*proto.GetFoldersResponse, error) {
|
||||
res, err := s.Impl.GetFolders(req.StorageId, int(req.Limit), req.From)
|
||||
|
||||
return &proto.GetFoldersResponse{
|
||||
Folders: res,
|
||||
}, err
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
package metadata
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/hashicorp/go-plugin"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/metadata/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
// PluginName defines the name for a metadata plugin
|
||||
PluginName = "metadata"
|
||||
)
|
||||
|
||||
var (
|
||||
// Handshake is a common handshake that is shared by plugin and host.
|
||||
Handshake = plugin.HandshakeConfig{
|
||||
ProtocolVersion: 1,
|
||||
MagicCookieKey: "SFTPGO_PLUGIN_METADATA",
|
||||
MagicCookieValue: "85dddeea-56d8-4d5b-b488-8b125edb3a0f",
|
||||
}
|
||||
// ErrNoSuchObject is the error that plugins must return if the request object does not exist
|
||||
ErrNoSuchObject = errors.New("no such object")
|
||||
// PluginMap is the map of plugins we can dispense.
|
||||
PluginMap = map[string]plugin.Plugin{
|
||||
PluginName: &Plugin{},
|
||||
}
|
||||
)
|
||||
|
||||
// Metadater defines the interface for metadata plugins
|
||||
type Metadater interface {
|
||||
SetModificationTime(storageID, objectPath string, mTime int64) error
|
||||
GetModificationTime(storageID, objectPath string) (int64, error)
|
||||
GetModificationTimes(storageID, objectPath string) (map[string]int64, error)
|
||||
RemoveMetadata(storageID, objectPath string) error
|
||||
GetFolders(storageID string, limit int, from string) ([]string, error)
|
||||
}
|
||||
|
||||
// Plugin defines the implementation to serve/connect to a metadata plugin
|
||||
type Plugin struct {
|
||||
plugin.Plugin
|
||||
Impl Metadater
|
||||
}
|
||||
|
||||
// GRPCServer defines the GRPC server implementation for this plugin
|
||||
func (p *Plugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error {
|
||||
proto.RegisterMetadataServer(s, &GRPCServer{
|
||||
Impl: p.Impl,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// GRPCClient defines the GRPC client implementation for this plugin
|
||||
func (p *Plugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) {
|
||||
return &GRPCClient{
|
||||
client: proto.NewMetadataClient(c),
|
||||
}, nil
|
||||
}
|
|
@ -1,938 +0,0 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.17.3
|
||||
// source: metadata/proto/metadata.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type SetModificationTimeRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
StorageId string `protobuf:"bytes,1,opt,name=storage_id,json=storageId,proto3" json:"storage_id,omitempty"`
|
||||
ObjectPath string `protobuf:"bytes,2,opt,name=object_path,json=objectPath,proto3" json:"object_path,omitempty"`
|
||||
ModificationTime int64 `protobuf:"varint,3,opt,name=modification_time,json=modificationTime,proto3" json:"modification_time,omitempty"`
|
||||
}
|
||||
|
||||
func (x *SetModificationTimeRequest) Reset() {
|
||||
*x = SetModificationTimeRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SetModificationTimeRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SetModificationTimeRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SetModificationTimeRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SetModificationTimeRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SetModificationTimeRequest) Descriptor() ([]byte, []int) {
|
||||
return file_metadata_proto_metadata_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *SetModificationTimeRequest) GetStorageId() string {
|
||||
if x != nil {
|
||||
return x.StorageId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SetModificationTimeRequest) GetObjectPath() string {
|
||||
if x != nil {
|
||||
return x.ObjectPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SetModificationTimeRequest) GetModificationTime() int64 {
|
||||
if x != nil {
|
||||
return x.ModificationTime
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetModificationTimeRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
StorageId string `protobuf:"bytes,1,opt,name=storage_id,json=storageId,proto3" json:"storage_id,omitempty"`
|
||||
ObjectPath string `protobuf:"bytes,2,opt,name=object_path,json=objectPath,proto3" json:"object_path,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetModificationTimeRequest) Reset() {
|
||||
*x = GetModificationTimeRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetModificationTimeRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetModificationTimeRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetModificationTimeRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetModificationTimeRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetModificationTimeRequest) Descriptor() ([]byte, []int) {
|
||||
return file_metadata_proto_metadata_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *GetModificationTimeRequest) GetStorageId() string {
|
||||
if x != nil {
|
||||
return x.StorageId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetModificationTimeRequest) GetObjectPath() string {
|
||||
if x != nil {
|
||||
return x.ObjectPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetModificationTimeResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ModificationTime int64 `protobuf:"varint,1,opt,name=modification_time,json=modificationTime,proto3" json:"modification_time,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetModificationTimeResponse) Reset() {
|
||||
*x = GetModificationTimeResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetModificationTimeResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetModificationTimeResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetModificationTimeResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetModificationTimeResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetModificationTimeResponse) Descriptor() ([]byte, []int) {
|
||||
return file_metadata_proto_metadata_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *GetModificationTimeResponse) GetModificationTime() int64 {
|
||||
if x != nil {
|
||||
return x.ModificationTime
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetModificationTimesRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
StorageId string `protobuf:"bytes,1,opt,name=storage_id,json=storageId,proto3" json:"storage_id,omitempty"`
|
||||
FolderPath string `protobuf:"bytes,2,opt,name=folder_path,json=folderPath,proto3" json:"folder_path,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetModificationTimesRequest) Reset() {
|
||||
*x = GetModificationTimesRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetModificationTimesRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetModificationTimesRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetModificationTimesRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetModificationTimesRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetModificationTimesRequest) Descriptor() ([]byte, []int) {
|
||||
return file_metadata_proto_metadata_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *GetModificationTimesRequest) GetStorageId() string {
|
||||
if x != nil {
|
||||
return x.StorageId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetModificationTimesRequest) GetFolderPath() string {
|
||||
if x != nil {
|
||||
return x.FolderPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetModificationTimesResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// the file name (not the full path) is the map key and the modification time is the map value
|
||||
Pairs map[string]int64 `protobuf:"bytes,1,rep,name=pairs,proto3" json:"pairs,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
|
||||
}
|
||||
|
||||
func (x *GetModificationTimesResponse) Reset() {
|
||||
*x = GetModificationTimesResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetModificationTimesResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetModificationTimesResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetModificationTimesResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetModificationTimesResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetModificationTimesResponse) Descriptor() ([]byte, []int) {
|
||||
return file_metadata_proto_metadata_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *GetModificationTimesResponse) GetPairs() map[string]int64 {
|
||||
if x != nil {
|
||||
return x.Pairs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type RemoveMetadataRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
StorageId string `protobuf:"bytes,1,opt,name=storage_id,json=storageId,proto3" json:"storage_id,omitempty"`
|
||||
ObjectPath string `protobuf:"bytes,2,opt,name=object_path,json=objectPath,proto3" json:"object_path,omitempty"`
|
||||
}
|
||||
|
||||
func (x *RemoveMetadataRequest) Reset() {
|
||||
*x = RemoveMetadataRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *RemoveMetadataRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RemoveMetadataRequest) ProtoMessage() {}
|
||||
|
||||
func (x *RemoveMetadataRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RemoveMetadataRequest.ProtoReflect.Descriptor instead.
|
||||
func (*RemoveMetadataRequest) Descriptor() ([]byte, []int) {
|
||||
return file_metadata_proto_metadata_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *RemoveMetadataRequest) GetStorageId() string {
|
||||
if x != nil {
|
||||
return x.StorageId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RemoveMetadataRequest) GetObjectPath() string {
|
||||
if x != nil {
|
||||
return x.ObjectPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetFoldersRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
StorageId string `protobuf:"bytes,1,opt,name=storage_id,json=storageId,proto3" json:"storage_id,omitempty"`
|
||||
Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||
From string `protobuf:"bytes,3,opt,name=from,proto3" json:"from,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetFoldersRequest) Reset() {
|
||||
*x = GetFoldersRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetFoldersRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetFoldersRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetFoldersRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetFoldersRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetFoldersRequest) Descriptor() ([]byte, []int) {
|
||||
return file_metadata_proto_metadata_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *GetFoldersRequest) GetStorageId() string {
|
||||
if x != nil {
|
||||
return x.StorageId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *GetFoldersRequest) GetLimit() int32 {
|
||||
if x != nil {
|
||||
return x.Limit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *GetFoldersRequest) GetFrom() string {
|
||||
if x != nil {
|
||||
return x.From
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type GetFoldersResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Folders []string `protobuf:"bytes,1,rep,name=folders,proto3" json:"folders,omitempty"`
|
||||
}
|
||||
|
||||
func (x *GetFoldersResponse) Reset() {
|
||||
*x = GetFoldersResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *GetFoldersResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetFoldersResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetFoldersResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_metadata_proto_metadata_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetFoldersResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetFoldersResponse) Descriptor() ([]byte, []int) {
|
||||
return file_metadata_proto_metadata_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *GetFoldersResponse) GetFolders() []string {
|
||||
if x != nil {
|
||||
return x.Folders
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_metadata_proto_metadata_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_metadata_proto_metadata_proto_rawDesc = []byte{
|
||||
0x0a, 0x1d, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x2f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||
0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x22, 0x89, 0x01, 0x0a, 0x1a, 0x53, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x69, 0x66,
|
||||
0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x49,
|
||||
0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61,
|
||||
0x74, 0x68, 0x12, 0x2b, 0x0a, 0x11, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6d,
|
||||
0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x22,
|
||||
0x5c, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a,
|
||||
0x0a, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x09, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b,
|
||||
0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x22, 0x4a, 0x0a,
|
||||
0x1b, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x54, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x11,
|
||||
0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x5d, 0x0a, 0x1b, 0x47, 0x65, 0x74,
|
||||
0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65,
|
||||
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x6f, 0x72,
|
||||
0x61, 0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74,
|
||||
0x6f, 0x72, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x6f, 0x6c, 0x64, 0x65,
|
||||
0x72, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x66, 0x6f,
|
||||
0x6c, 0x64, 0x65, 0x72, 0x50, 0x61, 0x74, 0x68, 0x22, 0x9e, 0x01, 0x0a, 0x1c, 0x47, 0x65, 0x74,
|
||||
0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65,
|
||||
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x05, 0x70, 0x61, 0x69,
|
||||
0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x2e, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x54, 0x69, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x50, 0x61,
|
||||
0x69, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x70, 0x61, 0x69, 0x72, 0x73, 0x1a,
|
||||
0x38, 0x0a, 0x0a, 0x50, 0x61, 0x69, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
|
||||
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
|
||||
0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x57, 0x0a, 0x15, 0x52, 0x65, 0x6d,
|
||||
0x6f, 0x76, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x5f, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x49,
|
||||
0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x50, 0x61,
|
||||
0x74, 0x68, 0x22, 0x5c, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x61,
|
||||
0x67, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x6f,
|
||||
0x72, 0x61, 0x67, 0x65, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x66, 0x72, 0x6f, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x72, 0x6f, 0x6d,
|
||||
0x22, 0x2e, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x66, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73,
|
||||
0x32, 0xa6, 0x03, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x50, 0x0a,
|
||||
0x13, 0x53, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x54, 0x69, 0x6d, 0x65, 0x12, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x65, 0x74,
|
||||
0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12,
|
||||
0x5c, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x21, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47,
|
||||
0x65, 0x74, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69,
|
||||
0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a,
|
||||
0x14, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x54, 0x69, 0x6d, 0x65, 0x73, 0x12, 0x22, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65,
|
||||
0x74, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46,
|
||||
0x0a, 0x0e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
|
||||
0x12, 0x1c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d,
|
||||
0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16,
|
||||
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||||
0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x41, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x6c,
|
||||
0x64, 0x65, 0x72, 0x73, 0x12, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74,
|
||||
0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x6c, 0x64, 0x65, 0x72,
|
||||
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x1b, 0x5a, 0x19, 0x73, 0x64, 0x6b,
|
||||
0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61,
|
||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_metadata_proto_metadata_proto_rawDescOnce sync.Once
|
||||
file_metadata_proto_metadata_proto_rawDescData = file_metadata_proto_metadata_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_metadata_proto_metadata_proto_rawDescGZIP() []byte {
|
||||
file_metadata_proto_metadata_proto_rawDescOnce.Do(func() {
|
||||
file_metadata_proto_metadata_proto_rawDescData = protoimpl.X.CompressGZIP(file_metadata_proto_metadata_proto_rawDescData)
|
||||
})
|
||||
return file_metadata_proto_metadata_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_metadata_proto_metadata_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_metadata_proto_metadata_proto_goTypes = []interface{}{
|
||||
(*SetModificationTimeRequest)(nil), // 0: proto.SetModificationTimeRequest
|
||||
(*GetModificationTimeRequest)(nil), // 1: proto.GetModificationTimeRequest
|
||||
(*GetModificationTimeResponse)(nil), // 2: proto.GetModificationTimeResponse
|
||||
(*GetModificationTimesRequest)(nil), // 3: proto.GetModificationTimesRequest
|
||||
(*GetModificationTimesResponse)(nil), // 4: proto.GetModificationTimesResponse
|
||||
(*RemoveMetadataRequest)(nil), // 5: proto.RemoveMetadataRequest
|
||||
(*GetFoldersRequest)(nil), // 6: proto.GetFoldersRequest
|
||||
(*GetFoldersResponse)(nil), // 7: proto.GetFoldersResponse
|
||||
nil, // 8: proto.GetModificationTimesResponse.PairsEntry
|
||||
(*emptypb.Empty)(nil), // 9: google.protobuf.Empty
|
||||
}
|
||||
var file_metadata_proto_metadata_proto_depIdxs = []int32{
|
||||
8, // 0: proto.GetModificationTimesResponse.pairs:type_name -> proto.GetModificationTimesResponse.PairsEntry
|
||||
0, // 1: proto.Metadata.SetModificationTime:input_type -> proto.SetModificationTimeRequest
|
||||
1, // 2: proto.Metadata.GetModificationTime:input_type -> proto.GetModificationTimeRequest
|
||||
3, // 3: proto.Metadata.GetModificationTimes:input_type -> proto.GetModificationTimesRequest
|
||||
5, // 4: proto.Metadata.RemoveMetadata:input_type -> proto.RemoveMetadataRequest
|
||||
6, // 5: proto.Metadata.GetFolders:input_type -> proto.GetFoldersRequest
|
||||
9, // 6: proto.Metadata.SetModificationTime:output_type -> google.protobuf.Empty
|
||||
2, // 7: proto.Metadata.GetModificationTime:output_type -> proto.GetModificationTimeResponse
|
||||
4, // 8: proto.Metadata.GetModificationTimes:output_type -> proto.GetModificationTimesResponse
|
||||
9, // 9: proto.Metadata.RemoveMetadata:output_type -> google.protobuf.Empty
|
||||
7, // 10: proto.Metadata.GetFolders:output_type -> proto.GetFoldersResponse
|
||||
6, // [6:11] is the sub-list for method output_type
|
||||
1, // [1:6] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_metadata_proto_metadata_proto_init() }
|
||||
func file_metadata_proto_metadata_proto_init() {
|
||||
if File_metadata_proto_metadata_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_metadata_proto_metadata_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SetModificationTimeRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_metadata_proto_metadata_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetModificationTimeRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_metadata_proto_metadata_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetModificationTimeResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_metadata_proto_metadata_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetModificationTimesRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_metadata_proto_metadata_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetModificationTimesResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_metadata_proto_metadata_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*RemoveMetadataRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_metadata_proto_metadata_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetFoldersRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_metadata_proto_metadata_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*GetFoldersResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_metadata_proto_metadata_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 9,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_metadata_proto_metadata_proto_goTypes,
|
||||
DependencyIndexes: file_metadata_proto_metadata_proto_depIdxs,
|
||||
MessageInfos: file_metadata_proto_metadata_proto_msgTypes,
|
||||
}.Build()
|
||||
File_metadata_proto_metadata_proto = out.File
|
||||
file_metadata_proto_metadata_proto_rawDesc = nil
|
||||
file_metadata_proto_metadata_proto_goTypes = nil
|
||||
file_metadata_proto_metadata_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// MetadataClient is the client API for Metadata service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type MetadataClient interface {
|
||||
SetModificationTime(ctx context.Context, in *SetModificationTimeRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
GetModificationTime(ctx context.Context, in *GetModificationTimeRequest, opts ...grpc.CallOption) (*GetModificationTimeResponse, error)
|
||||
GetModificationTimes(ctx context.Context, in *GetModificationTimesRequest, opts ...grpc.CallOption) (*GetModificationTimesResponse, error)
|
||||
RemoveMetadata(ctx context.Context, in *RemoveMetadataRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
GetFolders(ctx context.Context, in *GetFoldersRequest, opts ...grpc.CallOption) (*GetFoldersResponse, error)
|
||||
}
|
||||
|
||||
type metadataClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewMetadataClient(cc grpc.ClientConnInterface) MetadataClient {
|
||||
return &metadataClient{cc}
|
||||
}
|
||||
|
||||
func (c *metadataClient) SetModificationTime(ctx context.Context, in *SetModificationTimeRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
out := new(emptypb.Empty)
|
||||
err := c.cc.Invoke(ctx, "/proto.Metadata/SetModificationTime", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *metadataClient) GetModificationTime(ctx context.Context, in *GetModificationTimeRequest, opts ...grpc.CallOption) (*GetModificationTimeResponse, error) {
|
||||
out := new(GetModificationTimeResponse)
|
||||
err := c.cc.Invoke(ctx, "/proto.Metadata/GetModificationTime", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *metadataClient) GetModificationTimes(ctx context.Context, in *GetModificationTimesRequest, opts ...grpc.CallOption) (*GetModificationTimesResponse, error) {
|
||||
out := new(GetModificationTimesResponse)
|
||||
err := c.cc.Invoke(ctx, "/proto.Metadata/GetModificationTimes", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *metadataClient) RemoveMetadata(ctx context.Context, in *RemoveMetadataRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
out := new(emptypb.Empty)
|
||||
err := c.cc.Invoke(ctx, "/proto.Metadata/RemoveMetadata", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *metadataClient) GetFolders(ctx context.Context, in *GetFoldersRequest, opts ...grpc.CallOption) (*GetFoldersResponse, error) {
|
||||
out := new(GetFoldersResponse)
|
||||
err := c.cc.Invoke(ctx, "/proto.Metadata/GetFolders", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MetadataServer is the server API for Metadata service.
|
||||
type MetadataServer interface {
|
||||
SetModificationTime(context.Context, *SetModificationTimeRequest) (*emptypb.Empty, error)
|
||||
GetModificationTime(context.Context, *GetModificationTimeRequest) (*GetModificationTimeResponse, error)
|
||||
GetModificationTimes(context.Context, *GetModificationTimesRequest) (*GetModificationTimesResponse, error)
|
||||
RemoveMetadata(context.Context, *RemoveMetadataRequest) (*emptypb.Empty, error)
|
||||
GetFolders(context.Context, *GetFoldersRequest) (*GetFoldersResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedMetadataServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedMetadataServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedMetadataServer) SetModificationTime(context.Context, *SetModificationTimeRequest) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SetModificationTime not implemented")
|
||||
}
|
||||
func (*UnimplementedMetadataServer) GetModificationTime(context.Context, *GetModificationTimeRequest) (*GetModificationTimeResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetModificationTime not implemented")
|
||||
}
|
||||
func (*UnimplementedMetadataServer) GetModificationTimes(context.Context, *GetModificationTimesRequest) (*GetModificationTimesResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetModificationTimes not implemented")
|
||||
}
|
||||
func (*UnimplementedMetadataServer) RemoveMetadata(context.Context, *RemoveMetadataRequest) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RemoveMetadata not implemented")
|
||||
}
|
||||
func (*UnimplementedMetadataServer) GetFolders(context.Context, *GetFoldersRequest) (*GetFoldersResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetFolders not implemented")
|
||||
}
|
||||
|
||||
func RegisterMetadataServer(s *grpc.Server, srv MetadataServer) {
|
||||
s.RegisterService(&_Metadata_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Metadata_SetModificationTime_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SetModificationTimeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MetadataServer).SetModificationTime(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/proto.Metadata/SetModificationTime",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MetadataServer).SetModificationTime(ctx, req.(*SetModificationTimeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Metadata_GetModificationTime_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetModificationTimeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MetadataServer).GetModificationTime(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/proto.Metadata/GetModificationTime",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MetadataServer).GetModificationTime(ctx, req.(*GetModificationTimeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Metadata_GetModificationTimes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetModificationTimesRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MetadataServer).GetModificationTimes(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/proto.Metadata/GetModificationTimes",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MetadataServer).GetModificationTimes(ctx, req.(*GetModificationTimesRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Metadata_RemoveMetadata_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RemoveMetadataRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MetadataServer).RemoveMetadata(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/proto.Metadata/RemoveMetadata",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MetadataServer).RemoveMetadata(ctx, req.(*RemoveMetadataRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Metadata_GetFolders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetFoldersRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MetadataServer).GetFolders(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/proto.Metadata/GetFolders",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MetadataServer).GetFolders(ctx, req.(*GetFoldersRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Metadata_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "proto.Metadata",
|
||||
HandlerType: (*MetadataServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "SetModificationTime",
|
||||
Handler: _Metadata_SetModificationTime_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetModificationTime",
|
||||
Handler: _Metadata_GetModificationTime_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetModificationTimes",
|
||||
Handler: _Metadata_GetModificationTimes_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RemoveMetadata",
|
||||
Handler: _Metadata_RemoveMetadata_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetFolders",
|
||||
Handler: _Metadata_GetFolders_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "metadata/proto/metadata.proto",
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
syntax = "proto3";
|
||||
package proto;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
option go_package = "sdk/plugin/metadata/proto";
|
||||
|
||||
message SetModificationTimeRequest {
|
||||
string storage_id = 1;
|
||||
string object_path = 2;
|
||||
int64 modification_time = 3;
|
||||
}
|
||||
|
||||
message GetModificationTimeRequest {
|
||||
string storage_id = 1;
|
||||
string object_path = 2;
|
||||
}
|
||||
|
||||
message GetModificationTimeResponse {
|
||||
int64 modification_time = 1;
|
||||
}
|
||||
|
||||
message GetModificationTimesRequest {
|
||||
string storage_id = 1;
|
||||
string folder_path = 2;
|
||||
}
|
||||
|
||||
message GetModificationTimesResponse {
|
||||
// the file name (not the full path) is the map key and the modification time is the map value
|
||||
map<string,int64> pairs = 1;
|
||||
}
|
||||
|
||||
message RemoveMetadataRequest {
|
||||
string storage_id = 1;
|
||||
string object_path = 2;
|
||||
}
|
||||
|
||||
message GetFoldersRequest {
|
||||
string storage_id = 1;
|
||||
int32 limit = 2;
|
||||
string from = 3;
|
||||
}
|
||||
|
||||
message GetFoldersResponse {
|
||||
repeated string folders = 1;
|
||||
}
|
||||
|
||||
service Metadata {
|
||||
rpc SetModificationTime(SetModificationTimeRequest) returns (google.protobuf.Empty);
|
||||
rpc GetModificationTime(GetModificationTimeRequest) returns (GetModificationTimeResponse);
|
||||
rpc GetModificationTimes(GetModificationTimesRequest) returns (GetModificationTimesResponse);
|
||||
rpc RemoveMetadata(RemoveMetadataRequest) returns (google.protobuf.Empty);
|
||||
rpc GetFolders(GetFoldersRequest) returns (GetFoldersResponse);
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
protoc notifier/proto/notifier.proto --go_out=plugins=grpc:../.. --go_out=../../..
|
||||
protoc kms/proto/kms.proto --go_out=plugins=grpc:../.. --go_out=../../..
|
||||
protoc auth/proto/auth.proto --go_out=plugins=grpc:../.. --go_out=../../..
|
||||
protoc eventsearcher/proto/search.proto --go_out=plugins=grpc:../.. --go_out=../../..
|
||||
protoc metadata/proto/metadata.proto --go_out=plugins=grpc:../.. --go_out=../../..
|
|
@ -1,109 +0,0 @@
|
|||
package notifier
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/notifier/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
rpcTimeout = 20 * time.Second
|
||||
)
|
||||
|
||||
// GRPCClient is an implementation of Notifier interface that talks over RPC.
|
||||
type GRPCClient struct {
|
||||
client proto.NotifierClient
|
||||
}
|
||||
|
||||
// NotifyFsEvent implements the Notifier interface
|
||||
func (c *GRPCClient) NotifyFsEvent(event *FsEvent) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
_, err := c.client.SendFsEvent(ctx, &proto.FsEvent{
|
||||
Timestamp: event.Timestamp,
|
||||
Action: event.Action,
|
||||
Username: event.Username,
|
||||
FsPath: event.Path,
|
||||
FsTargetPath: event.TargetPath,
|
||||
SshCmd: event.SSHCmd,
|
||||
FileSize: event.FileSize,
|
||||
Protocol: event.Protocol,
|
||||
Ip: event.IP,
|
||||
Status: int32(event.Status),
|
||||
VirtualPath: event.VirtualPath,
|
||||
VirtualTargetPath: event.VirtualTargetPath,
|
||||
SessionId: event.SessionID,
|
||||
FsProvider: int32(event.FsProvider),
|
||||
Bucket: event.Bucket,
|
||||
Endpoint: event.Endpoint,
|
||||
OpenFlags: int32(event.OpenFlags),
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// NotifyProviderEvent implements the Notifier interface
|
||||
func (c *GRPCClient) NotifyProviderEvent(event *ProviderEvent) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), rpcTimeout)
|
||||
defer cancel()
|
||||
|
||||
_, err := c.client.SendProviderEvent(ctx, &proto.ProviderEvent{
|
||||
Timestamp: event.Timestamp,
|
||||
Action: event.Action,
|
||||
ObjectType: event.ObjectType,
|
||||
Username: event.Username,
|
||||
Ip: event.IP,
|
||||
ObjectName: event.ObjectName,
|
||||
ObjectData: event.ObjectData,
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// GRPCServer defines the gRPC server that GRPCClient talks to.
|
||||
type GRPCServer struct {
|
||||
Impl Notifier
|
||||
}
|
||||
|
||||
// SendFsEvent implements the serve side fs notify method
|
||||
func (s *GRPCServer) SendFsEvent(ctx context.Context, req *proto.FsEvent) (*emptypb.Empty, error) {
|
||||
event := &FsEvent{
|
||||
Action: req.Action,
|
||||
Username: req.Username,
|
||||
Path: req.FsPath,
|
||||
TargetPath: req.FsTargetPath,
|
||||
VirtualPath: req.VirtualPath,
|
||||
SSHCmd: req.SshCmd,
|
||||
FileSize: req.FileSize,
|
||||
Status: int(req.Status),
|
||||
Protocol: req.Protocol,
|
||||
IP: req.Ip,
|
||||
SessionID: req.SessionId,
|
||||
Timestamp: req.Timestamp,
|
||||
FsProvider: int(req.FsProvider),
|
||||
Bucket: req.Bucket,
|
||||
Endpoint: req.Endpoint,
|
||||
OpenFlags: int(req.OpenFlags),
|
||||
}
|
||||
err := s.Impl.NotifyFsEvent(event)
|
||||
return &emptypb.Empty{}, err
|
||||
}
|
||||
|
||||
// SendProviderEvent implements the serve side provider event notify method
|
||||
func (s *GRPCServer) SendProviderEvent(ctx context.Context, req *proto.ProviderEvent) (*emptypb.Empty, error) {
|
||||
event := &ProviderEvent{
|
||||
Action: req.Action,
|
||||
Username: req.Username,
|
||||
ObjectType: req.ObjectType,
|
||||
ObjectName: req.ObjectName,
|
||||
IP: req.Ip,
|
||||
ObjectData: req.ObjectData,
|
||||
Timestamp: req.Timestamp,
|
||||
}
|
||||
err := s.Impl.NotifyProviderEvent(event)
|
||||
return &emptypb.Empty{}, err
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
// Package notifier defines the implementation for event notifier plugins.
|
||||
// Notifier plugins allow to receive notifications for supported filesystem
|
||||
// events such as file uploads, downloads etc. and provider events such as
|
||||
// objects add, update, delete.
|
||||
package notifier
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/go-plugin"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/notifier/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
// PluginName defines the name for a notifier plugin
|
||||
PluginName = "notifier"
|
||||
)
|
||||
|
||||
// Handshake is a common handshake that is shared by plugin and host.
|
||||
var Handshake = plugin.HandshakeConfig{
|
||||
ProtocolVersion: 1,
|
||||
MagicCookieKey: "SFTPGO_PLUGIN_NOTIFIER",
|
||||
MagicCookieValue: "c499b98b-cd59-4df2-92b3-6268817f4d80",
|
||||
}
|
||||
|
||||
// PluginMap is the map of plugins we can dispense.
|
||||
var PluginMap = map[string]plugin.Plugin{
|
||||
PluginName: &Plugin{},
|
||||
}
|
||||
|
||||
// FsEvent defines a file system event
|
||||
type FsEvent struct {
|
||||
Action string `json:"action"`
|
||||
Username string `json:"username"`
|
||||
Path string `json:"path"`
|
||||
TargetPath string `json:"target_path,omitempty"`
|
||||
VirtualPath string `json:"virtual_path"`
|
||||
VirtualTargetPath string `json:"virtual_target_path,omitempty"`
|
||||
SSHCmd string `json:"ssh_cmd,omitempty"`
|
||||
FileSize int64 `json:"file_size,omitempty"`
|
||||
FsProvider int `json:"fs_provider"`
|
||||
Bucket string `json:"bucket,omitempty"`
|
||||
Endpoint string `json:"endpoint,omitempty"`
|
||||
Status int `json:"status"`
|
||||
Protocol string `json:"protocol"`
|
||||
IP string `json:"ip"`
|
||||
SessionID string `json:"session_id"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
OpenFlags int `json:"open_flags,omitempty"`
|
||||
}
|
||||
|
||||
// ProviderEvent defines a provider event
|
||||
type ProviderEvent struct {
|
||||
Action string
|
||||
Username string
|
||||
ObjectType string
|
||||
ObjectName string
|
||||
IP string
|
||||
ObjectData []byte
|
||||
Timestamp int64
|
||||
}
|
||||
|
||||
// Notifier defines the interface for notifiers plugins
|
||||
type Notifier interface {
|
||||
NotifyFsEvent(event *FsEvent) error
|
||||
NotifyProviderEvent(event *ProviderEvent) error
|
||||
}
|
||||
|
||||
// Plugin defines the implementation to serve/connect to a notifier plugin
|
||||
type Plugin struct {
|
||||
plugin.Plugin
|
||||
Impl Notifier
|
||||
}
|
||||
|
||||
// GRPCServer defines the GRPC server implementation for this plugin
|
||||
func (p *Plugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error {
|
||||
proto.RegisterNotifierServer(s, &GRPCServer{
|
||||
Impl: p.Impl,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// GRPCClient defines the GRPC client implementation for this plugin
|
||||
func (p *Plugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error) {
|
||||
return &GRPCClient{
|
||||
client: proto.NewNotifierClient(c),
|
||||
}, nil
|
||||
}
|
|
@ -1,559 +0,0 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.19.1
|
||||
// source: notifier/proto/notifier.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type FsEvent struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
||||
Action string `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"`
|
||||
Username string `protobuf:"bytes,3,opt,name=username,proto3" json:"username,omitempty"`
|
||||
FsPath string `protobuf:"bytes,4,opt,name=fs_path,json=fsPath,proto3" json:"fs_path,omitempty"`
|
||||
FsTargetPath string `protobuf:"bytes,5,opt,name=fs_target_path,json=fsTargetPath,proto3" json:"fs_target_path,omitempty"`
|
||||
SshCmd string `protobuf:"bytes,6,opt,name=ssh_cmd,json=sshCmd,proto3" json:"ssh_cmd,omitempty"`
|
||||
FileSize int64 `protobuf:"varint,7,opt,name=file_size,json=fileSize,proto3" json:"file_size,omitempty"`
|
||||
Protocol string `protobuf:"bytes,8,opt,name=protocol,proto3" json:"protocol,omitempty"`
|
||||
Status int32 `protobuf:"varint,9,opt,name=status,proto3" json:"status,omitempty"`
|
||||
Ip string `protobuf:"bytes,10,opt,name=ip,proto3" json:"ip,omitempty"`
|
||||
VirtualPath string `protobuf:"bytes,11,opt,name=virtual_path,json=virtualPath,proto3" json:"virtual_path,omitempty"`
|
||||
VirtualTargetPath string `protobuf:"bytes,12,opt,name=virtual_target_path,json=virtualTargetPath,proto3" json:"virtual_target_path,omitempty"`
|
||||
SessionId string `protobuf:"bytes,13,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"`
|
||||
FsProvider int32 `protobuf:"varint,14,opt,name=fs_provider,json=fsProvider,proto3" json:"fs_provider,omitempty"`
|
||||
Bucket string `protobuf:"bytes,15,opt,name=bucket,proto3" json:"bucket,omitempty"`
|
||||
Endpoint string `protobuf:"bytes,16,opt,name=endpoint,proto3" json:"endpoint,omitempty"`
|
||||
OpenFlags int32 `protobuf:"varint,17,opt,name=open_flags,json=openFlags,proto3" json:"open_flags,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FsEvent) Reset() {
|
||||
*x = FsEvent{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_notifier_proto_notifier_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FsEvent) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FsEvent) ProtoMessage() {}
|
||||
|
||||
func (x *FsEvent) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_notifier_proto_notifier_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use FsEvent.ProtoReflect.Descriptor instead.
|
||||
func (*FsEvent) Descriptor() ([]byte, []int) {
|
||||
return file_notifier_proto_notifier_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetTimestamp() int64 {
|
||||
if x != nil {
|
||||
return x.Timestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetAction() string {
|
||||
if x != nil {
|
||||
return x.Action
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetFsPath() string {
|
||||
if x != nil {
|
||||
return x.FsPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetFsTargetPath() string {
|
||||
if x != nil {
|
||||
return x.FsTargetPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetSshCmd() string {
|
||||
if x != nil {
|
||||
return x.SshCmd
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetFileSize() int64 {
|
||||
if x != nil {
|
||||
return x.FileSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetProtocol() string {
|
||||
if x != nil {
|
||||
return x.Protocol
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetStatus() int32 {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetIp() string {
|
||||
if x != nil {
|
||||
return x.Ip
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetVirtualPath() string {
|
||||
if x != nil {
|
||||
return x.VirtualPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetVirtualTargetPath() string {
|
||||
if x != nil {
|
||||
return x.VirtualTargetPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetSessionId() string {
|
||||
if x != nil {
|
||||
return x.SessionId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetFsProvider() int32 {
|
||||
if x != nil {
|
||||
return x.FsProvider
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetBucket() string {
|
||||
if x != nil {
|
||||
return x.Bucket
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetEndpoint() string {
|
||||
if x != nil {
|
||||
return x.Endpoint
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FsEvent) GetOpenFlags() int32 {
|
||||
if x != nil {
|
||||
return x.OpenFlags
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type ProviderEvent struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
|
||||
Action string `protobuf:"bytes,2,opt,name=action,proto3" json:"action,omitempty"`
|
||||
ObjectType string `protobuf:"bytes,3,opt,name=object_type,json=objectType,proto3" json:"object_type,omitempty"`
|
||||
Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"`
|
||||
Ip string `protobuf:"bytes,5,opt,name=ip,proto3" json:"ip,omitempty"`
|
||||
ObjectName string `protobuf:"bytes,6,opt,name=object_name,json=objectName,proto3" json:"object_name,omitempty"`
|
||||
ObjectData []byte `protobuf:"bytes,7,opt,name=object_data,json=objectData,proto3" json:"object_data,omitempty"` // object JSON serialized
|
||||
}
|
||||
|
||||
func (x *ProviderEvent) Reset() {
|
||||
*x = ProviderEvent{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_notifier_proto_notifier_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ProviderEvent) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ProviderEvent) ProtoMessage() {}
|
||||
|
||||
func (x *ProviderEvent) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_notifier_proto_notifier_proto_msgTypes[1]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ProviderEvent.ProtoReflect.Descriptor instead.
|
||||
func (*ProviderEvent) Descriptor() ([]byte, []int) {
|
||||
return file_notifier_proto_notifier_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ProviderEvent) GetTimestamp() int64 {
|
||||
if x != nil {
|
||||
return x.Timestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ProviderEvent) GetAction() string {
|
||||
if x != nil {
|
||||
return x.Action
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ProviderEvent) GetObjectType() string {
|
||||
if x != nil {
|
||||
return x.ObjectType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ProviderEvent) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ProviderEvent) GetIp() string {
|
||||
if x != nil {
|
||||
return x.Ip
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ProviderEvent) GetObjectName() string {
|
||||
if x != nil {
|
||||
return x.ObjectName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ProviderEvent) GetObjectData() []byte {
|
||||
if x != nil {
|
||||
return x.ObjectData
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_notifier_proto_notifier_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_notifier_proto_notifier_proto_rawDesc = []byte{
|
||||
0x0a, 0x1d, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x2f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||
0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x22, 0xfa, 0x03, 0x0a, 0x07, 0x46, 0x73, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12,
|
||||
0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d,
|
||||
0x65, 0x12, 0x17, 0x0a, 0x07, 0x66, 0x73, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x06, 0x66, 0x73, 0x50, 0x61, 0x74, 0x68, 0x12, 0x24, 0x0a, 0x0e, 0x66, 0x73,
|
||||
0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0c, 0x66, 0x73, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x61, 0x74, 0x68,
|
||||
0x12, 0x17, 0x0a, 0x07, 0x73, 0x73, 0x68, 0x5f, 0x63, 0x6d, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x06, 0x73, 0x73, 0x68, 0x43, 0x6d, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69, 0x6c,
|
||||
0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63,
|
||||
0x6f, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63,
|
||||
0x6f, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x09, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70,
|
||||
0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x21, 0x0a, 0x0c, 0x76, 0x69,
|
||||
0x72, 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0b, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x50, 0x61, 0x74, 0x68, 0x12, 0x2e, 0x0a,
|
||||
0x13, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f,
|
||||
0x70, 0x61, 0x74, 0x68, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x76, 0x69, 0x72, 0x74,
|
||||
0x75, 0x61, 0x6c, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x1d, 0x0a,
|
||||
0x0a, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x09, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b,
|
||||
0x66, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x0e, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x0a, 0x66, 0x73, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x62, 0x75, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x62,
|
||||
0x75, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
|
||||
0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
|
||||
0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18,
|
||||
0x11, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6f, 0x70, 0x65, 0x6e, 0x46, 0x6c, 0x61, 0x67, 0x73,
|
||||
0x22, 0xd4, 0x01, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x45, 0x76, 0x65,
|
||||
0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x06, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65,
|
||||
0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f,
|
||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65,
|
||||
0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65,
|
||||
0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5f,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x62, 0x6a, 0x65,
|
||||
0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74,
|
||||
0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x6f, 0x62, 0x6a,
|
||||
0x65, 0x63, 0x74, 0x44, 0x61, 0x74, 0x61, 0x32, 0x84, 0x01, 0x0a, 0x08, 0x4e, 0x6f, 0x74, 0x69,
|
||||
0x66, 0x69, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x46, 0x73, 0x45, 0x76,
|
||||
0x65, 0x6e, 0x74, 0x12, 0x0e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x46, 0x73, 0x45, 0x76,
|
||||
0x65, 0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x41, 0x0a, 0x11, 0x53,
|
||||
0x65, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x45, 0x76, 0x65, 0x6e, 0x74,
|
||||
0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65,
|
||||
0x72, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x1b,
|
||||
0x5a, 0x19, 0x73, 0x64, 0x6b, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x6e, 0x6f, 0x74,
|
||||
0x69, 0x66, 0x69, 0x65, 0x72, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_notifier_proto_notifier_proto_rawDescOnce sync.Once
|
||||
file_notifier_proto_notifier_proto_rawDescData = file_notifier_proto_notifier_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_notifier_proto_notifier_proto_rawDescGZIP() []byte {
|
||||
file_notifier_proto_notifier_proto_rawDescOnce.Do(func() {
|
||||
file_notifier_proto_notifier_proto_rawDescData = protoimpl.X.CompressGZIP(file_notifier_proto_notifier_proto_rawDescData)
|
||||
})
|
||||
return file_notifier_proto_notifier_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_notifier_proto_notifier_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_notifier_proto_notifier_proto_goTypes = []interface{}{
|
||||
(*FsEvent)(nil), // 0: proto.FsEvent
|
||||
(*ProviderEvent)(nil), // 1: proto.ProviderEvent
|
||||
(*emptypb.Empty)(nil), // 2: google.protobuf.Empty
|
||||
}
|
||||
var file_notifier_proto_notifier_proto_depIdxs = []int32{
|
||||
0, // 0: proto.Notifier.SendFsEvent:input_type -> proto.FsEvent
|
||||
1, // 1: proto.Notifier.SendProviderEvent:input_type -> proto.ProviderEvent
|
||||
2, // 2: proto.Notifier.SendFsEvent:output_type -> google.protobuf.Empty
|
||||
2, // 3: proto.Notifier.SendProviderEvent:output_type -> google.protobuf.Empty
|
||||
2, // [2:4] is the sub-list for method output_type
|
||||
0, // [0:2] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_notifier_proto_notifier_proto_init() }
|
||||
func file_notifier_proto_notifier_proto_init() {
|
||||
if File_notifier_proto_notifier_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_notifier_proto_notifier_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FsEvent); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_notifier_proto_notifier_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ProviderEvent); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_notifier_proto_notifier_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_notifier_proto_notifier_proto_goTypes,
|
||||
DependencyIndexes: file_notifier_proto_notifier_proto_depIdxs,
|
||||
MessageInfos: file_notifier_proto_notifier_proto_msgTypes,
|
||||
}.Build()
|
||||
File_notifier_proto_notifier_proto = out.File
|
||||
file_notifier_proto_notifier_proto_rawDesc = nil
|
||||
file_notifier_proto_notifier_proto_goTypes = nil
|
||||
file_notifier_proto_notifier_proto_depIdxs = nil
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConnInterface
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion6
|
||||
|
||||
// NotifierClient is the client API for Notifier service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type NotifierClient interface {
|
||||
SendFsEvent(ctx context.Context, in *FsEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
SendProviderEvent(ctx context.Context, in *ProviderEvent, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
}
|
||||
|
||||
type notifierClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewNotifierClient(cc grpc.ClientConnInterface) NotifierClient {
|
||||
return ¬ifierClient{cc}
|
||||
}
|
||||
|
||||
func (c *notifierClient) SendFsEvent(ctx context.Context, in *FsEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
out := new(emptypb.Empty)
|
||||
err := c.cc.Invoke(ctx, "/proto.Notifier/SendFsEvent", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *notifierClient) SendProviderEvent(ctx context.Context, in *ProviderEvent, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
out := new(emptypb.Empty)
|
||||
err := c.cc.Invoke(ctx, "/proto.Notifier/SendProviderEvent", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// NotifierServer is the server API for Notifier service.
|
||||
type NotifierServer interface {
|
||||
SendFsEvent(context.Context, *FsEvent) (*emptypb.Empty, error)
|
||||
SendProviderEvent(context.Context, *ProviderEvent) (*emptypb.Empty, error)
|
||||
}
|
||||
|
||||
// UnimplementedNotifierServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedNotifierServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedNotifierServer) SendFsEvent(context.Context, *FsEvent) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SendFsEvent not implemented")
|
||||
}
|
||||
func (*UnimplementedNotifierServer) SendProviderEvent(context.Context, *ProviderEvent) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method SendProviderEvent not implemented")
|
||||
}
|
||||
|
||||
func RegisterNotifierServer(s *grpc.Server, srv NotifierServer) {
|
||||
s.RegisterService(&_Notifier_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Notifier_SendFsEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FsEvent)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NotifierServer).SendFsEvent(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/proto.Notifier/SendFsEvent",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NotifierServer).SendFsEvent(ctx, req.(*FsEvent))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Notifier_SendProviderEvent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ProviderEvent)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NotifierServer).SendProviderEvent(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/proto.Notifier/SendProviderEvent",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NotifierServer).SendProviderEvent(ctx, req.(*ProviderEvent))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Notifier_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "proto.Notifier",
|
||||
HandlerType: (*NotifierServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "SendFsEvent",
|
||||
Handler: _Notifier_SendFsEvent_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SendProviderEvent",
|
||||
Handler: _Notifier_SendProviderEvent_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "notifier/proto/notifier.proto",
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
syntax = "proto3";
|
||||
package proto;
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
option go_package = "sdk/plugin/notifier/proto";
|
||||
|
||||
message FsEvent {
|
||||
int64 timestamp = 1;
|
||||
string action = 2;
|
||||
string username = 3;
|
||||
string fs_path = 4;
|
||||
string fs_target_path = 5;
|
||||
string ssh_cmd = 6;
|
||||
int64 file_size = 7;
|
||||
string protocol = 8;
|
||||
int32 status = 9;
|
||||
string ip = 10;
|
||||
string virtual_path = 11;
|
||||
string virtual_target_path = 12;
|
||||
string session_id = 13;
|
||||
int32 fs_provider = 14;
|
||||
string bucket = 15;
|
||||
string endpoint = 16;
|
||||
int32 open_flags = 17;
|
||||
}
|
||||
|
||||
message ProviderEvent {
|
||||
int64 timestamp = 1;
|
||||
string action = 2;
|
||||
string object_type = 3;
|
||||
string username = 4;
|
||||
string ip = 5;
|
||||
string object_name = 6;
|
||||
bytes object_data = 7; // object JSON serialized
|
||||
}
|
||||
|
||||
service Notifier {
|
||||
rpc SendFsEvent(FsEvent) returns (google.protobuf.Empty);
|
||||
rpc SendProviderEvent(ProviderEvent) returns (google.protobuf.Empty);
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
package plugin
|
|
@ -1,2 +0,0 @@
|
|||
// Package sdk provides SFTPGo data structures primarily intended for use within plugins
|
||||
package sdk
|
262
sdk/user.go
262
sdk/user.go
|
@ -1,262 +0,0 @@
|
|||
package sdk
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/sdk/kms"
|
||||
)
|
||||
|
||||
// Web Client/user REST API restrictions
|
||||
const (
|
||||
WebClientPubKeyChangeDisabled = "publickey-change-disabled"
|
||||
WebClientWriteDisabled = "write-disabled"
|
||||
WebClientMFADisabled = "mfa-disabled"
|
||||
WebClientPasswordChangeDisabled = "password-change-disabled"
|
||||
WebClientAPIKeyAuthChangeDisabled = "api-key-auth-change-disabled"
|
||||
WebClientInfoChangeDisabled = "info-change-disabled"
|
||||
WebClientSharesDisabled = "shares-disabled"
|
||||
WebClientPasswordResetDisabled = "password-reset-disabled"
|
||||
)
|
||||
|
||||
var (
|
||||
// WebClientOptions defines the available options for the web client interface/user REST API
|
||||
WebClientOptions = []string{WebClientWriteDisabled, WebClientPasswordChangeDisabled, WebClientPasswordResetDisabled,
|
||||
WebClientPubKeyChangeDisabled, WebClientMFADisabled, WebClientAPIKeyAuthChangeDisabled, WebClientInfoChangeDisabled,
|
||||
WebClientSharesDisabled}
|
||||
// UserTypes defines the supported user type hints for auth plugins
|
||||
UserTypes = []string{string(UserTypeLDAP), string(UserTypeOS)}
|
||||
)
|
||||
|
||||
// TLSUsername defines the TLS certificate attribute to use as username
|
||||
type TLSUsername string
|
||||
|
||||
// Supported certificate attributes to use as username
|
||||
const (
|
||||
TLSUsernameNone TLSUsername = "None"
|
||||
TLSUsernameCN TLSUsername = "CommonName"
|
||||
)
|
||||
|
||||
// UserType defines the supported user types.
|
||||
// This is an hint for external auth plugins, is not used in SFTPGo directly
|
||||
type UserType string
|
||||
|
||||
// User types, auth plugins could use this info to choose the correct authentication backend
|
||||
const (
|
||||
UserTypeLDAP UserType = "LDAPUser"
|
||||
UserTypeOS UserType = "OSUser"
|
||||
)
|
||||
|
||||
// DirectoryPermissions defines permissions for a directory virtual path
|
||||
type DirectoryPermissions struct {
|
||||
Path string
|
||||
Permissions []string
|
||||
}
|
||||
|
||||
// PatternsFilter defines filters based on shell like patterns.
|
||||
// These restrictions do not apply to files listing for performance reasons, so
|
||||
// a denied file cannot be downloaded/overwritten/renamed but will still be
|
||||
// in the list of files.
|
||||
// System commands such as Git and rsync interacts with the filesystem directly
|
||||
// and they are not aware about these restrictions so they are not allowed
|
||||
// inside paths with extensions filters
|
||||
type PatternsFilter struct {
|
||||
// Virtual path, if no other specific filter is defined, the filter applies for
|
||||
// sub directories too.
|
||||
// For example if filters are defined for the paths "/" and "/sub" then the
|
||||
// filters for "/" are applied for any file outside the "/sub" directory
|
||||
Path string `json:"path"`
|
||||
// files with these, case insensitive, patterns are allowed.
|
||||
// Denied file patterns are evaluated before the allowed ones
|
||||
AllowedPatterns []string `json:"allowed_patterns,omitempty"`
|
||||
// files with these, case insensitive, patterns are not allowed.
|
||||
// Denied file patterns are evaluated before the allowed ones
|
||||
DeniedPatterns []string `json:"denied_patterns,omitempty"`
|
||||
}
|
||||
|
||||
// GetCommaSeparatedPatterns returns the first non empty patterns list comma separated
|
||||
func (p *PatternsFilter) GetCommaSeparatedPatterns() string {
|
||||
if len(p.DeniedPatterns) > 0 {
|
||||
return strings.Join(p.DeniedPatterns, ",")
|
||||
}
|
||||
return strings.Join(p.AllowedPatterns, ",")
|
||||
}
|
||||
|
||||
// IsDenied returns true if the patterns has one or more denied patterns
|
||||
func (p *PatternsFilter) IsDenied() bool {
|
||||
return len(p.DeniedPatterns) > 0
|
||||
}
|
||||
|
||||
// IsAllowed returns true if the patterns has one or more allowed patterns
|
||||
func (p *PatternsFilter) IsAllowed() bool {
|
||||
return len(p.AllowedPatterns) > 0
|
||||
}
|
||||
|
||||
// HooksFilter defines user specific overrides for global hooks
|
||||
type HooksFilter struct {
|
||||
ExternalAuthDisabled bool `json:"external_auth_disabled"`
|
||||
PreLoginDisabled bool `json:"pre_login_disabled"`
|
||||
CheckPasswordDisabled bool `json:"check_password_disabled"`
|
||||
}
|
||||
|
||||
// RecoveryCode defines a 2FA recovery code
|
||||
type RecoveryCode struct {
|
||||
Secret kms.BaseSecret `json:"secret"`
|
||||
Used bool `json:"used,omitempty"`
|
||||
}
|
||||
|
||||
// TOTPConfig defines the time-based one time password configuration
|
||||
type TOTPConfig struct {
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
ConfigName string `json:"config_name,omitempty"`
|
||||
Secret kms.BaseSecret `json:"secret,omitempty"`
|
||||
// TOTP will be required for the specified protocols.
|
||||
// SSH protocol (SFTP/SCP/SSH commands) will ask for the TOTP passcode if the client uses keyboard interactive
|
||||
// authentication.
|
||||
// FTP have no standard way to support two factor authentication, if you
|
||||
// enable the support for this protocol you have to add the TOTP passcode after the password.
|
||||
// For example if your password is "password" and your one time passcode is
|
||||
// "123456" you have to use "password123456" as password.
|
||||
Protocols []string `json:"protocols,omitempty"`
|
||||
}
|
||||
|
||||
// BandwidthLimit defines a per-source bandwidth limit
|
||||
type BandwidthLimit struct {
|
||||
// Source networks in CIDR notation as defined in RFC 4632 and RFC 4291
|
||||
// for example "192.0.2.0/24" or "2001:db8::/32". The limit applies if the
|
||||
// defined networks contain the client IP
|
||||
Sources []string `json:"sources"`
|
||||
// Maximum upload bandwidth as KB/s
|
||||
UploadBandwidth int64 `json:"upload_bandwidth,omitempty"`
|
||||
// Maximum download bandwidth as KB/s
|
||||
DownloadBandwidth int64 `json:"download_bandwidth,omitempty"`
|
||||
}
|
||||
|
||||
// GetSourcesAsString returns the sources as comma separated string
|
||||
func (l *BandwidthLimit) GetSourcesAsString() string {
|
||||
return strings.Join(l.Sources, ",")
|
||||
}
|
||||
|
||||
// BaseUserFilters defines additional restrictions for a user
|
||||
type BaseUserFilters struct {
|
||||
// only clients connecting from these IP/Mask are allowed.
|
||||
// IP/Mask must be in CIDR notation as defined in RFC 4632 and RFC 4291
|
||||
// for example "192.0.2.0/24" or "2001:db8::/32"
|
||||
AllowedIP []string `json:"allowed_ip,omitempty"`
|
||||
// clients connecting from these IP/Mask are not allowed.
|
||||
// Denied rules will be evaluated before allowed ones
|
||||
DeniedIP []string `json:"denied_ip,omitempty"`
|
||||
// these login methods are not allowed.
|
||||
// If null or empty any available login method is allowed
|
||||
DeniedLoginMethods []string `json:"denied_login_methods,omitempty"`
|
||||
// these protocols are not allowed.
|
||||
// If null or empty any available protocol is allowed
|
||||
DeniedProtocols []string `json:"denied_protocols,omitempty"`
|
||||
// filter based on shell patterns.
|
||||
// Please note that these restrictions can be easily bypassed.
|
||||
FilePatterns []PatternsFilter `json:"file_patterns,omitempty"`
|
||||
// max size allowed for a single upload, 0 means unlimited
|
||||
MaxUploadFileSize int64 `json:"max_upload_file_size,omitempty"`
|
||||
// TLS certificate attribute to use as username.
|
||||
// For FTP clients it must match the name provided using the
|
||||
// "USER" command
|
||||
TLSUsername TLSUsername `json:"tls_username,omitempty"`
|
||||
// user specific hook overrides
|
||||
Hooks HooksFilter `json:"hooks,omitempty"`
|
||||
// Disable checks for existence and automatic creation of home directory
|
||||
// and virtual folders.
|
||||
// SFTPGo requires that the user's home directory, virtual folder root,
|
||||
// and intermediate paths to virtual folders exist to work properly.
|
||||
// If you already know that the required directories exist, disabling
|
||||
// these checks will speed up login.
|
||||
// You could, for example, disable these checks after the first login
|
||||
DisableFsChecks bool `json:"disable_fs_checks,omitempty"`
|
||||
// WebClient related configuration options
|
||||
WebClient []string `json:"web_client,omitempty"`
|
||||
// API key auth allows to impersonate this user with an API key
|
||||
AllowAPIKeyAuth bool `json:"allow_api_key_auth,omitempty"`
|
||||
// UserType is an hint for authentication plugins.
|
||||
// It is ignored when using SFTPGo internal authentication
|
||||
UserType string `json:"user_type,omitempty"`
|
||||
// Per-source bandwidth limits
|
||||
BandwidthLimits []BandwidthLimit `json:"bandwidth_limits,omitempty"`
|
||||
}
|
||||
|
||||
// UserFilters defines additional restrictions for a user
|
||||
// TODO: rename to UserOptions in v3
|
||||
type UserFilters struct {
|
||||
BaseUserFilters
|
||||
// Time-based one time passwords configuration
|
||||
TOTPConfig TOTPConfig `json:"totp_config,omitempty"`
|
||||
// Recovery codes to use if the user loses access to their second factor auth device.
|
||||
// Each code can only be used once, you should use these codes to login and disable or
|
||||
// reset 2FA for your account
|
||||
RecoveryCodes []RecoveryCode `json:"recovery_codes,omitempty"`
|
||||
}
|
||||
|
||||
// BaseUser defines the shared user fields
|
||||
type BaseUser struct {
|
||||
// Data provider unique identifier
|
||||
ID int64 `json:"id"`
|
||||
// 1 enabled, 0 disabled (login is not allowed)
|
||||
Status int `json:"status"`
|
||||
// Username
|
||||
Username string `json:"username"`
|
||||
// Email
|
||||
Email string `json:"email,omitempty"`
|
||||
// Account expiration date as unix timestamp in milliseconds. An expired account cannot login.
|
||||
// 0 means no expiration
|
||||
ExpirationDate int64 `json:"expiration_date"`
|
||||
// Password used for password authentication.
|
||||
// For users created using SFTPGo REST API the password is be stored using bcrypt or argon2id hashing algo.
|
||||
// Checking passwords stored with pbkdf2, md5crypt and sha512crypt is supported too.
|
||||
Password string `json:"password,omitempty"`
|
||||
// PublicKeys used for public key authentication. At least one between password and a public key is mandatory
|
||||
PublicKeys []string `json:"public_keys,omitempty"`
|
||||
// The user cannot upload or download files outside this directory. Must be an absolute path
|
||||
HomeDir string `json:"home_dir"`
|
||||
// If sftpgo runs as root system user then the created files and directories will be assigned to this system UID
|
||||
UID int `json:"uid"`
|
||||
// If sftpgo runs as root system user then the created files and directories will be assigned to this system GID
|
||||
GID int `json:"gid"`
|
||||
// Maximum concurrent sessions. 0 means unlimited
|
||||
MaxSessions int `json:"max_sessions"`
|
||||
// Maximum size allowed as bytes. 0 means unlimited
|
||||
QuotaSize int64 `json:"quota_size"`
|
||||
// Maximum number of files allowed. 0 means unlimited
|
||||
QuotaFiles int `json:"quota_files"`
|
||||
// List of the granted permissions
|
||||
Permissions map[string][]string `json:"permissions"`
|
||||
// Used quota as bytes
|
||||
UsedQuotaSize int64 `json:"used_quota_size,omitempty"`
|
||||
// Used quota as number of files
|
||||
UsedQuotaFiles int `json:"used_quota_files,omitempty"`
|
||||
// Last quota update as unix timestamp in milliseconds
|
||||
LastQuotaUpdate int64 `json:"last_quota_update,omitempty"`
|
||||
// Maximum upload bandwidth as KB/s, 0 means unlimited.
|
||||
// This is the default if no per-source limit match
|
||||
UploadBandwidth int64 `json:"upload_bandwidth,omitempty"`
|
||||
// Maximum download bandwidth as KB/s, 0 means unlimited.
|
||||
// This is the default if no per-source limit match
|
||||
DownloadBandwidth int64 `json:"download_bandwidth,omitempty"`
|
||||
// Last login as unix timestamp in milliseconds
|
||||
LastLogin int64 `json:"last_login,omitempty"`
|
||||
// Creation time as unix timestamp in milliseconds. It will be 0 for admins created before v2.2.0
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
// last update time as unix timestamp in milliseconds
|
||||
UpdatedAt int64 `json:"updated_at"`
|
||||
// optional description, for example full name
|
||||
Description string `json:"description,omitempty"`
|
||||
// free form text field for external systems
|
||||
AdditionalInfo string `json:"additional_info,omitempty"`
|
||||
}
|
||||
|
||||
// User defines a SFTPGo user
|
||||
type User struct {
|
||||
BaseUser
|
||||
// Additional restrictions
|
||||
Filters UserFilters `json:"filters"`
|
||||
// Mapping between virtual paths and virtual folders
|
||||
VirtualFolders []VirtualFolder `json:"virtual_folders,omitempty"`
|
||||
// Filesystem configuration details
|
||||
FsConfig Filesystem `json:"filesystem"`
|
||||
}
|
|
@ -13,13 +13,13 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/grandcat/zeroconf"
|
||||
"github.com/sftpgo/sdk"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/config"
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/ftpd"
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/sftpd"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/version"
|
||||
|
|
|
@ -11,12 +11,12 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/minio/sio"
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/httpdtest"
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import (
|
|||
|
||||
"github.com/eikenb/pipeat"
|
||||
"github.com/pkg/sftp"
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"golang.org/x/crypto/ssh"
|
||||
|
@ -21,7 +22,6 @@ import (
|
|||
"github.com/drakkan/sftpgo/v2/common"
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
|
|
@ -35,6 +35,8 @@ import (
|
|||
|
||||
"github.com/pkg/sftp"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sftpgo/sdk"
|
||||
sdkkms "github.com/sftpgo/sdk/kms"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"golang.org/x/crypto/ssh"
|
||||
|
||||
|
@ -45,8 +47,6 @@ import (
|
|||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/mfa"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
sdkkms "github.com/drakkan/sftpgo/v2/sdk/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sftpd"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
|
|
|
@ -18,13 +18,13 @@ import (
|
|||
|
||||
"github.com/google/shlex"
|
||||
fscopy "github.com/otiai10/copy"
|
||||
"github.com/sftpgo/sdk"
|
||||
"golang.org/x/crypto/ssh"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/common"
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/metric"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
|
|
@ -4,8 +4,8 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/eventsearcher"
|
||||
"github.com/hashicorp/go-plugin"
|
||||
"github.com/sftpgo/sdk/plugin/eventsearcher"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -3,8 +3,9 @@ package vfs
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/sftpgo/sdk"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/sftpgo/sdk"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
)
|
||||
|
||||
|
|
|
@ -17,11 +17,11 @@ import (
|
|||
"github.com/eikenb/pipeat"
|
||||
"github.com/pkg/sftp"
|
||||
"github.com/rs/xid"
|
||||
"github.com/sftpgo/sdk"
|
||||
"golang.org/x/crypto/ssh"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/version"
|
||||
)
|
||||
|
|
|
@ -15,12 +15,12 @@ import (
|
|||
|
||||
"github.com/eikenb/pipeat"
|
||||
"github.com/pkg/sftp"
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/sftpgo/sdk/plugin/metadata"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/plugin"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/sdk/plugin/metadata"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
)
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/eikenb/pipeat"
|
||||
"github.com/sftpgo/sdk"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"golang.org/x/net/webdav"
|
||||
|
||||
"github.com/drakkan/sftpgo/v2/common"
|
||||
"github.com/drakkan/sftpgo/v2/dataprovider"
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
"github.com/drakkan/sftpgo/v2/util"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
)
|
||||
|
|
|
@ -23,6 +23,8 @@ import (
|
|||
|
||||
"github.com/minio/sio"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/sftpgo/sdk"
|
||||
sdkkms "github.com/sftpgo/sdk/kms"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/studio-b12/gowebdav"
|
||||
|
||||
|
@ -33,8 +35,6 @@ import (
|
|||
"github.com/drakkan/sftpgo/v2/httpdtest"
|
||||
"github.com/drakkan/sftpgo/v2/kms"
|
||||
"github.com/drakkan/sftpgo/v2/logger"
|
||||
"github.com/drakkan/sftpgo/v2/sdk"
|
||||
sdkkms "github.com/drakkan/sftpgo/v2/sdk/kms"
|
||||
"github.com/drakkan/sftpgo/v2/sftpd"
|
||||
"github.com/drakkan/sftpgo/v2/vfs"
|
||||
"github.com/drakkan/sftpgo/v2/webdavd"
|
||||
|
|
Loading…
Reference in a new issue