1/*
2 * Copyright 2015-present Facebook, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19namespace folly {
20
21class SocketAddressTestHelper {
22 public:
23 static constexpr const char* kLoopbackAddrIPv4 = "127.0.0.1";
24 static constexpr const char* kLoopbackAddrIPv6 = "::1";
25
26 // https://developers.google.com/speed/public-dns/docs/using?hl=en
27 static constexpr const char* kGooglePublicDnsAName =
28 "google-public-dns-a.google.com";
29 static constexpr const char* kGooglePublicDnsBName =
30 "google-public-dns-b.google.com";
31 static constexpr const char* kGooglePublicDnsAAddrIPv4 = "8.8.8.8";
32 static constexpr const char* kGooglePublicDnsBAddrIPv4 = "8.8.4.4";
33 static constexpr const char* kGooglePublicDnsAAddrIPv6 =
34 "2001:4860:4860::8888";
35 static constexpr const char* kGooglePublicDnsBAddrIPv6 =
36 "2001:4860:4860::8844";
37
38 static bool isIPv4Enabled();
39 static bool isIPv6Enabled();
40
41 private:
42 static bool isFamilyOfAddrEnabled(const char* addr);
43};
44} // namespace folly
45