@@ -72,9 +72,8 @@ func (s *TCPConnectSimulator) Simulate(ctx context.Context, dst string) error {
72
72
if conn != nil {
73
73
conn .Close ()
74
74
}
75
- // This will likely generate some superfluous io-timeout error messages, but if the
76
- // user specifies a misconfigured interface, they'll see the simulation failing.
77
- if err != nil && (! isSoftError (err , "connect: connection refused" ) || isDialError (err )) {
75
+ // Ignore "connection refused" and timeouts.
76
+ if err != nil && ! isSoftError (err , "connect: connection refused" ) {
78
77
return err
79
78
}
80
79
return nil
@@ -111,24 +110,14 @@ func (s *DNSResolveSimulator) Simulate(ctx context.Context, dst string) error {
111
110
host = utils .FQDN (host )
112
111
113
112
_ , err := r .LookupHost (ctx , host )
114
- // Ignore "no such host". Will ignore timeouts as well, so check for dial errors .
115
- if err != nil && ( ! isSoftError (err , "no such host" ) || isDialError ( err ) ) {
113
+ // Ignore "no such host" and timeouts.
114
+ if err != nil && ! isSoftError (err , "no such host" ) {
116
115
return err
117
116
}
118
117
119
118
return nil
120
119
}
121
120
122
- // isDialError scans an error message for signs of a dial error, returning a boolean.
123
- func isDialError (err error ) bool {
124
- // Errors we're after are of the form:
125
- // lookup abc.sandbox.alphasoc.xyz. on A.B.C.D:53: dial udp E.F.G.H:0->A.B.C.D:53: i/o timeout
126
- // TODO: something more robust? I don't want to double-dial though.
127
- return isTimeout (err ) &&
128
- strings .Contains (err .Error (), "dial" ) &&
129
- strings .Count (err .Error (), "->" ) == 1
130
- }
131
-
132
121
func isTimeout (err error ) bool {
133
122
netErr , ok := err .(net.Error )
134
123
if ! ok {
0 commit comments