Tests the DNS resolver builder with different target names.
(t *testing.T)
| 862 | |
| 863 | // Tests the DNS resolver builder with different target names. |
| 864 | func (s) TestResolverBuild(t *testing.T) { |
| 865 | tests := []struct { |
| 866 | name string |
| 867 | target string |
| 868 | wantErr string |
| 869 | }{ |
| 870 | { |
| 871 | name: "valid url", |
| 872 | target: "www.google.com", |
| 873 | }, |
| 874 | { |
| 875 | name: "host port", |
| 876 | target: "foo.bar:12345", |
| 877 | }, |
| 878 | { |
| 879 | name: "ipv4 address with default port", |
| 880 | target: "127.0.0.1", |
| 881 | }, |
| 882 | { |
| 883 | name: "ipv6 address without brackets and default port", |
| 884 | target: "::", |
| 885 | }, |
| 886 | { |
| 887 | name: "ipv4 address with non-default port", |
| 888 | target: "127.0.0.1:12345", |
| 889 | }, |
| 890 | { |
| 891 | name: "localhost ipv6 with brackets", |
| 892 | target: "[::1]:80", |
| 893 | }, |
| 894 | { |
| 895 | name: "ipv6 address with brackets", |
| 896 | target: "[2001:db8:a0b:12f0::1]:21", |
| 897 | }, |
| 898 | { |
| 899 | name: "empty host with port", |
| 900 | target: ":80", |
| 901 | }, |
| 902 | { |
| 903 | name: "ipv6 address with zone", |
| 904 | target: "[fe80::1%25lo0]:80", |
| 905 | }, |
| 906 | { |
| 907 | name: "url with port", |
| 908 | target: "golang.org:http", |
| 909 | }, |
| 910 | { |
| 911 | name: "ipv6 address with non integer port", |
| 912 | target: "[2001:db8::1]:http", |
| 913 | }, |
| 914 | { |
| 915 | name: "address ends with colon", |
| 916 | target: "[2001:db8::1]:", |
| 917 | wantErr: dnsinternal.ErrEndsWithColon.Error(), |
| 918 | }, |
| 919 | { |
| 920 | name: "address contains only a colon", |
| 921 | target: ":", |
nothing calls this directly
no test coverage detected