Schemes returns the list of transport schemes used by all the server endpoints. The possible values for the elements of the returned slice are "http", "https", "grpc" and "grpcs".
()
| 113 | // endpoints. The possible values for the elements of the returned slice are |
| 114 | // "http", "https", "grpc" and "grpcs". |
| 115 | func (s *ServerExpr) Schemes() []string { |
| 116 | schemes := make(map[string]struct{}) |
| 117 | for _, h := range s.Hosts { |
| 118 | for _, sch := range h.Schemes() { |
| 119 | schemes[sch] = struct{}{} |
| 120 | } |
| 121 | } |
| 122 | ss := make([]string, len(schemes)) |
| 123 | i := 0 |
| 124 | for s := range schemes { |
| 125 | ss[i] = s |
| 126 | i++ |
| 127 | } |
| 128 | sort.Strings(ss) |
| 129 | return ss |
| 130 | } |
| 131 | |
| 132 | var validSchemes = map[string]struct{}{"http": {}, "https": {}, "grpc": {}, "grpcs": {}} |
| 133 |