Skip to content

agent: split SimplexNameDomain out of SimplexNameInfo#1788

Merged
epoberezkin merged 4 commits into
stablefrom
sh/split
May 29, 2026
Merged

agent: split SimplexNameDomain out of SimplexNameInfo#1788
epoberezkin merged 4 commits into
stablefrom
sh/split

Conversation

@shumvgolove
Copy link
Copy Markdown
Collaborator

No description provided.

The type now separates the user-supplied type prefix (#/@) from the
domain itself:

  data SimplexNameInfo = SimplexNameInfo
    { nameType :: SimplexNameType
    , nameDomain :: SimplexNameDomain
    }

  data SimplexNameDomain = SimplexNameDomain
    { nameTLD :: SimplexTLD
    , domain :: Text
    , subDomain :: [Text]
    }

The domain is independent of the contact-vs-public-group distinction —
the same dotted-labels structure applies to both. Future code that
needs to talk about a domain without committing to a name type (e.g.
server-side TLD-based registry lookup) can use SimplexNameDomain
directly.

fullDomainName now operates on SimplexNameDomain rather than the
full info wrapper. Parser, StrEncoding instance, and aeson derivations
updated accordingly. No external callers needed updating.
Comment thread src/Simplex/Messaging/Agent/Protocol.hs Outdated

fullDomainName :: SimplexNameInfo -> Text
fullDomainName SimplexNameInfo {nameTLD, domain, subDomain} = T.intercalate "." (reverse subDomain ++ [domain] ++ tld')
[name] -> Right $ SimplexNameDomain TLDSimplex name []
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not a valid domain, it's only valid as part of channel name

Comment thread src/Simplex/Messaging/Agent/Protocol.hs Outdated
"testing" : name : sub -> Right $ SimplexNameDomain TLDTesting name sub
_ -> Right $ SimplexNameDomain TLDWeb (T.intercalate "." labels) []

instance StrEncoding SimplexNameInfo where
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move above

Comment thread src/Simplex/Messaging/Agent/Protocol.hs Outdated
where
infoP NTContact = do
bs <- lookAhead $ A.takeWhile1 (not . A.isSpace)
unless (B.elem '.' bs) $ fail "contact name requires TLD"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be the opposite. Not contact is more restrictive, but channel should be more permissive than domain parser

@epoberezkin epoberezkin merged commit ee2ff40 into stable May 29, 2026
4 of 6 checks passed
@epoberezkin epoberezkin deleted the sh/split branch May 29, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants