validation.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // Copyright 2023 The frp Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package validation
  15. import (
  16. "errors"
  17. v1 "github.com/fatedier/frp/pkg/config/v1"
  18. splugin "github.com/fatedier/frp/pkg/plugin/server"
  19. )
  20. var (
  21. SupportedTransportProtocols = []string{
  22. "tcp",
  23. "kcp",
  24. "quic",
  25. "websocket",
  26. "wss",
  27. }
  28. SupportedAuthMethods = []v1.AuthMethod{
  29. "token",
  30. "oidc",
  31. }
  32. SupportedAuthAdditionalScopes = []v1.AuthScope{
  33. "HeartBeats",
  34. "NewWorkConns",
  35. }
  36. SupportedLogLevels = []string{
  37. "trace",
  38. "debug",
  39. "info",
  40. "warn",
  41. "error",
  42. }
  43. SupportedHTTPPluginOps = []string{
  44. splugin.OpLogin,
  45. splugin.OpNewProxy,
  46. splugin.OpCloseProxy,
  47. splugin.OpPing,
  48. splugin.OpNewWorkConn,
  49. splugin.OpNewUserConn,
  50. }
  51. )
  52. type Warning error
  53. func AppendError(err error, errs ...error) error {
  54. if len(errs) == 0 {
  55. return err
  56. }
  57. return errors.Join(append([]error{err}, errs...)...)
  58. }