protocol returns true if the protocol proto is configured/enabled.
(proto string)
| 913 | |
| 914 | // protocol returns true if the protocol proto is configured/enabled. |
| 915 | func (s *Server) protocol(proto string) bool { |
| 916 | if s.ListenProtocols == nil { |
| 917 | return slices.Contains(s.protocolsWithDefaults(), proto) |
| 918 | } |
| 919 | |
| 920 | for _, lnProtocols := range s.ListenProtocols { |
| 921 | if slices.Contains(s.listenerProtocolsWithDefaults(lnProtocols), proto) { |
| 922 | return true |
| 923 | } |
| 924 | } |
| 925 | |
| 926 | return false |
| 927 | } |
| 928 | |
| 929 | func (s *Server) protocolsWithDefaults() []string { |
| 930 | if len(s.Protocols) == 0 { |
no test coverage detected