gitea源码

security_protocol.go 853B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2021 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package ldap
  4. // SecurityProtocol protocol type
  5. type SecurityProtocol int
  6. // Note: new type must be added at the end of list to maintain compatibility.
  7. const (
  8. SecurityProtocolUnencrypted SecurityProtocol = iota
  9. SecurityProtocolLDAPS
  10. SecurityProtocolStartTLS
  11. )
  12. // String returns the name of the SecurityProtocol
  13. func (s SecurityProtocol) String() string {
  14. return SecurityProtocolNames[s]
  15. }
  16. // Int returns the int value of the SecurityProtocol
  17. func (s SecurityProtocol) Int() int {
  18. return int(s)
  19. }
  20. // SecurityProtocolNames contains the name of SecurityProtocol values.
  21. var SecurityProtocolNames = map[SecurityProtocol]string{
  22. SecurityProtocolUnencrypted: "Unencrypted",
  23. SecurityProtocolLDAPS: "LDAPS",
  24. SecurityProtocolStartTLS: "StartTLS",
  25. }