(auth *Auth)
| 141 | } |
| 142 | |
| 143 | func authWebsocketsEnabled(auth *Auth) bool { |
| 144 | if auth == nil { |
| 145 | return false |
| 146 | } |
| 147 | if len(auth.Attributes) > 0 { |
| 148 | if raw := strings.TrimSpace(auth.Attributes["websockets"]); raw != "" { |
| 149 | parsed, errParse := strconv.ParseBool(raw) |
| 150 | if errParse == nil { |
| 151 | return parsed |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | if len(auth.Metadata) == 0 { |
| 156 | return false |
| 157 | } |
| 158 | raw, ok := auth.Metadata["websockets"] |
| 159 | if !ok || raw == nil { |
| 160 | return false |
| 161 | } |
| 162 | switch v := raw.(type) { |
| 163 | case bool: |
| 164 | return v |
| 165 | case string: |
| 166 | parsed, errParse := strconv.ParseBool(strings.TrimSpace(v)) |
| 167 | if errParse == nil { |
| 168 | return parsed |
| 169 | } |
| 170 | default: |
| 171 | } |
| 172 | return false |
| 173 | } |
| 174 | |
| 175 | func preferCodexWebsocketAuths(ctx context.Context, provider string, available []*Auth) []*Auth { |
| 176 | if len(available) == 0 { |
no outgoing calls