|
1 | 1 | use super::*; |
2 | 2 | use crate::checks::*; |
3 | 3 |
|
| 4 | +use base64::prelude::BASE64_STANDARD; |
| 5 | +use base64::Engine; |
4 | 6 | use std::io::BufReader; |
5 | 7 |
|
6 | 8 | #[test] |
@@ -36,7 +38,7 @@ fn test_xor_safe_bsmaller() -> Result<()> { |
36 | 38 | #[test] |
37 | 39 | fn test_xormapped_address_get_from() -> Result<()> { |
38 | 40 | let mut m = Message::new(); |
39 | | - let transaction_id = base64::decode("jxhBARZwX+rsC6er").unwrap(); |
| 41 | + let transaction_id = BASE64_STANDARD.decode("jxhBARZwX+rsC6er").unwrap(); |
40 | 42 | m.transaction_id.0.copy_from_slice(&transaction_id); |
41 | 43 | let addr_value = vec![0x00, 0x01, 0x9c, 0xd5, 0xf4, 0x9f, 0x38, 0xae]; |
42 | 44 | m.add(ATTR_XORMAPPED_ADDRESS, &addr_value); |
@@ -104,7 +106,7 @@ fn test_xormapped_address_get_from() -> Result<()> { |
104 | 106 | #[test] |
105 | 107 | fn test_xormapped_address_get_from_invalid() -> Result<()> { |
106 | 108 | let mut m = Message::new(); |
107 | | - let transaction_id = base64::decode("jxhBARZwX+rsC6er").unwrap(); |
| 109 | + let transaction_id = BASE64_STANDARD.decode("jxhBARZwX+rsC6er").unwrap(); |
108 | 110 | m.transaction_id.0.copy_from_slice(&transaction_id); |
109 | 111 | let expected_ip: IpAddr = "213.141.156.236".parse().unwrap(); |
110 | 112 | let expected_port = 21254u16; |
@@ -134,7 +136,7 @@ fn test_xormapped_address_get_from_invalid() -> Result<()> { |
134 | 136 | #[test] |
135 | 137 | fn test_xormapped_address_add_to() -> Result<()> { |
136 | 138 | let mut m = Message::new(); |
137 | | - let transaction_id = base64::decode("jxhBARZwX+rsC6er").unwrap(); |
| 139 | + let transaction_id = BASE64_STANDARD.decode("jxhBARZwX+rsC6er").unwrap(); |
138 | 140 | m.transaction_id.0.copy_from_slice(&transaction_id); |
139 | 141 | let expected_ip: IpAddr = "213.141.156.236".parse().unwrap(); |
140 | 142 | let expected_port = 21254u16; |
@@ -166,7 +168,7 @@ fn test_xormapped_address_add_to() -> Result<()> { |
166 | 168 | #[test] |
167 | 169 | fn test_xormapped_address_add_to_ipv6() -> Result<()> { |
168 | 170 | let mut m = Message::new(); |
169 | | - let transaction_id = base64::decode("jxhBARZwX+rsC6er").unwrap(); |
| 171 | + let transaction_id = BASE64_STANDARD.decode("jxhBARZwX+rsC6er").unwrap(); |
170 | 172 | m.transaction_id.0.copy_from_slice(&transaction_id); |
171 | 173 | let expected_ip: IpAddr = "fe80::dc2b:44ff:fe20:6009".parse().unwrap(); |
172 | 174 | let expected_port = 21254u16; |
|
0 commit comments