remove . from domain names

Signed-off-by: R.I.Pienaar <rip@devco.net>
This commit is contained in:
R.I.Pienaar
2021-05-07 14:46:22 +02:00
parent 0bc6ac2e14
commit cc9b6735a5
2 changed files with 6 additions and 1 deletions

View File

@@ -209,7 +209,7 @@ func (s *Server) enableJetStream(cfg JetStreamConfig) error {
s.Noticef(" Max Storage: %s", friendlyBytes(cfg.MaxStore))
s.Noticef(" Store Directory: \"%s\"", cfg.StoreDir)
if cfg.Domain != _EMPTY_ {
s.Noticef(" Enable Domain: %s", cfg.Domain)
s.Noticef(" Domain: %s", cfg.Domain)
}
s.Noticef("-------------------------------------------")
@@ -1949,6 +1949,10 @@ func validateJetStreamOptions(o *Options) error {
if subj := fmt.Sprintf(jsDomainAPI, o.JetStreamDomain); !IsValidSubject(subj) {
return fmt.Errorf("invalid domain name: derived %q is not a valid subject", subj)
}
if !isValidName(o.JetStreamDomain) {
return fmt.Errorf("invalid domain name: may not contain ., * or >")
}
}
// If not clustered no checks needed past here.
if !o.JetStream || o.Cluster.Port == 0 {

View File

@@ -11225,6 +11225,7 @@ func TestJetStreamServerDomainBadConfig(t *testing.T) {
shouldFail("CORE.")
shouldFail(".CORE")
shouldFail("C.*.O. RE")
shouldFail("C.ORE")
}
func TestJetStreamServerDomainConfig(t *testing.T) {