datatype: add DiameterURI Parse() method (RFC 6733 §4.3)#241
Merged
Conversation
Parse the aaa:// and aaas:// URI schemes extracting FQDN, port, transport, and protocol parameters per the RFC 6733 §4.3 ABNF. The aaas:// scheme indicates TLS-secured transport (default port 5868) while aaa:// indicates unsecured (default port 3868). Backwards-compatible: the raw OctetString wire encoding is unchanged. Fixes fiorix#237
Owner
|
Logic is right, a few things to address before merge:
Happy either way: address here, or merge and follow up — your call. |
- Replace custom indexOf/lastIndexByte with strings.Index/LastIndexByte
- Use strings.EqualFold for case-insensitive scheme matching (RFC 6733 §4.3)
- Use strconv.ParseUint(portStr, 10, 16) to reject ports > 65535
- Reject empty port ("host:") explicitly
- Add test cases for case-insensitive schemes, port overflow, empty port
tridentsx
added a commit
to tridentsx/go-diameter
that referenced
this pull request
May 9, 2026
* datatype: add DiameterURI Parse() method (RFC 6733 §4.3) Parse the aaa:// and aaas:// URI schemes extracting FQDN, port, transport, and protocol parameters per the RFC 6733 §4.3 ABNF. The aaas:// scheme indicates TLS-secured transport (default port 5868) while aaa:// indicates unsecured (default port 3868). Backwards-compatible: the raw OctetString wire encoding is unchanged. Fixes fiorix#237 * datatype: address review comments on DiameterURI Parse - Replace custom indexOf/lastIndexByte with strings.Index/LastIndexByte - Use strings.EqualFold for case-insensitive scheme matching (RFC 6733 §4.3) - Use strconv.ParseUint(portStr, 10, 16) to reject ports > 65535 - Reject empty port ("host:") explicitly - Add test cases for case-insensitive schemes, port overflow, empty port
arberkatellari
pushed a commit
to arberkatellari/go-diameter
that referenced
this pull request
May 12, 2026
* datatype: add DiameterURI Parse() method (RFC 6733 §4.3) Parse the aaa:// and aaas:// URI schemes extracting FQDN, port, transport, and protocol parameters per the RFC 6733 §4.3 ABNF. The aaas:// scheme indicates TLS-secured transport (default port 5868) while aaa:// indicates unsecured (default port 3868). Backwards-compatible: the raw OctetString wire encoding is unchanged. Fixes fiorix#237 * datatype: address review comments on DiameterURI Parse - Replace custom indexOf/lastIndexByte with strings.Index/LastIndexByte - Use strings.EqualFold for case-insensitive scheme matching (RFC 6733 §4.3) - Use strconv.ParseUint(portStr, 10, 16) to reject ports > 65535 - Reject empty port ("host:") explicitly - Add test cases for case-insensitive schemes, port overflow, empty port
danbogos
pushed a commit
to cgrates/go-diameter
that referenced
this pull request
May 12, 2026
* datatype: add DiameterURI Parse() method (RFC 6733 §4.3) Parse the aaa:// and aaas:// URI schemes extracting FQDN, port, transport, and protocol parameters per the RFC 6733 §4.3 ABNF. The aaas:// scheme indicates TLS-secured transport (default port 5868) while aaa:// indicates unsecured (default port 3868). Backwards-compatible: the raw OctetString wire encoding is unchanged. Fixes fiorix#237 * datatype: address review comments on DiameterURI Parse - Replace custom indexOf/lastIndexByte with strings.Index/LastIndexByte - Use strings.EqualFold for case-insensitive scheme matching (RFC 6733 §4.3) - Use strconv.ParseUint(portStr, 10, 16) to reject ports > 65535 - Reject empty port ("host:") explicitly - Add test cases for case-insensitive schemes, port overflow, empty port
kulcsartibor
pushed a commit
to kulcsartibor/go-diameter
that referenced
this pull request
Jun 10, 2026
* datatype: add DiameterURI Parse() method (RFC 6733 §4.3) Parse the aaa:// and aaas:// URI schemes extracting FQDN, port, transport, and protocol parameters per the RFC 6733 §4.3 ABNF. The aaas:// scheme indicates TLS-secured transport (default port 5868) while aaa:// indicates unsecured (default port 3868). Backwards-compatible: the raw OctetString wire encoding is unchanged. Fixes fiorix#237 * datatype: address review comments on DiameterURI Parse - Replace custom indexOf/lastIndexByte with strings.Index/LastIndexByte - Use strings.EqualFold for case-insensitive scheme matching (RFC 6733 §4.3) - Use strconv.ParseUint(portStr, 10, 16) to reject ports > 65535 - Reject empty port ("host:") explicitly - Add test cases for case-insensitive schemes, port overflow, empty port
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a
Parse()method toDiameterURIthat extracts scheme (aaa://vsaaas://), FQDN, port, transport, and protocol per the RFC 6733 §4.3 ABNF.Changes
ParsedDiameterURIstruct with Secure, FQDN, Port, Transport, Protocol fieldsParse()method toDiameterURItypeaaa://→ port 3868,aaas://→ port 5868, transport=tcp, protocol=diameterRFC Reference
RFC 6733 §4.3 defines:
Backwards-compatible: the raw OctetString wire encoding is unchanged.
Fixes #237