| 1013 | } |
| 1014 | |
| 1015 | func validateSubject(subject string) error { |
| 1016 | if subject == "" { |
| 1017 | return fmt.Errorf("%w: %s", ErrInvalidSubject, "subject cannot be empty") |
| 1018 | } |
| 1019 | if subject[0] == '.' || subject[len(subject)-1] == '.' || !subjectRegexp.MatchString(subject) { |
| 1020 | return fmt.Errorf("%w: %s", ErrInvalidSubject, subject) |
| 1021 | } |
| 1022 | return nil |
| 1023 | } |
| 1024 | |
| 1025 | // AccountInfo fetches account information from the server, containing details |
| 1026 | // about the account associated with this JetStream connection. If account is |