@@ -18,26 +18,6 @@ use core::fmt::Write;
18
18
19
19
use crate :: Error ;
20
20
21
- /// A DNS name that may be either a DNS name identifier presented by a server (which may include
22
- /// wildcards), or a DNS name identifier referenced by a client for matching purposes (wildcards
23
- /// not permitted).
24
- pub enum GeneralDnsNameRef < ' name > {
25
- /// a reference to a DNS name that may be used for matching purposes.
26
- DnsName ( DnsNameRef < ' name > ) ,
27
- /// a reference to a presented DNS name that may include a wildcard.
28
- Wildcard ( WildcardDnsNameRef < ' name > ) ,
29
- }
30
-
31
- impl < ' a > GeneralDnsNameRef < ' a > {
32
- /// Yields the DNS name as a `&str`.
33
- pub fn as_str ( & self ) -> & ' a str {
34
- match self {
35
- Self :: DnsName ( name) => name. as_str ( ) ,
36
- Self :: Wildcard ( name) => name. as_str ( ) ,
37
- }
38
- }
39
- }
40
-
41
21
/// A DNS Name suitable for use in the TLS Server Name Indication (SNI)
42
22
/// extension and/or for use as the reference hostname for which to verify a
43
23
/// certificate.
@@ -147,12 +127,12 @@ impl core::fmt::Debug for DnsNameRef<'_> {
147
127
/// [RFC 5280 Section 7.2]: https://tools.ietf.org/html/rfc5280#section-7.2
148
128
/// [RFC 6125 Section 4.1]: https://www.rfc-editor.org/rfc/rfc6125#section-4.1
149
129
#[ derive( Clone , Copy , Eq , PartialEq , Hash ) ]
150
- pub struct WildcardDnsNameRef < ' a > ( & ' a [ u8 ] ) ;
130
+ pub ( crate ) struct WildcardDnsNameRef < ' a > ( & ' a [ u8 ] ) ;
151
131
152
132
impl < ' a > WildcardDnsNameRef < ' a > {
153
133
/// Constructs a `WildcardDnsNameRef` from the given input if the input is a
154
134
/// syntactically-valid DNS name.
155
- pub fn try_from_ascii ( dns_name : & ' a [ u8 ] ) -> Result < Self , InvalidDnsNameError > {
135
+ pub ( crate ) fn try_from_ascii ( dns_name : & ' a [ u8 ] ) -> Result < Self , InvalidDnsNameError > {
156
136
if !is_valid_dns_id (
157
137
untrusted:: Input :: from ( dns_name) ,
158
138
IdRole :: Reference ,
@@ -164,14 +144,8 @@ impl<'a> WildcardDnsNameRef<'a> {
164
144
Ok ( Self ( dns_name) )
165
145
}
166
146
167
- /// Constructs a `WildcardDnsNameRef` from the given input if the input is a
168
- /// syntactically-valid DNS name.
169
- pub fn try_from_ascii_str ( dns_name : & ' a str ) -> Result < Self , InvalidDnsNameError > {
170
- Self :: try_from_ascii ( dns_name. as_bytes ( ) )
171
- }
172
-
173
147
/// Yields a reference to the DNS name as a `&str`.
174
- pub fn as_str ( & self ) -> & ' a str {
148
+ pub ( crate ) fn as_str ( & self ) -> & ' a str {
175
149
// The unwrap won't fail because a `WildcardDnsNameRef` is guaranteed to be ASCII and
176
150
// ASCII is a subset of UTF-8.
177
151
core:: str:: from_utf8 ( self . 0 ) . unwrap ( )
0 commit comments