Skip to content
Snippets Groups Projects
Commit bf222db9 authored by Oliver Herms's avatar Oliver Herms
Browse files

Refactoring

parent c23d31fe
No related branches found
No related tags found
No related merge requests found
...@@ -7,21 +7,23 @@ import ( ...@@ -7,21 +7,23 @@ import (
) )
func setTTL(c net.Conn, ttl uint8) error { func setTTL(c net.Conn, ttl uint8) error {
// as c is an interface for testability reason we're checking here if the concrete type
// is a real TCP connection as only that supports setting a TTL
switch c.(type) { switch c.(type) {
case *tcp.Conn: case *tcp.Conn:
return c.(*tcp.Conn).SetTTL(ttl)
default: default:
return nil return nil
} }
return c.(*tcp.Conn).SetTTL(ttl)
} }
func setDontRoute(c net.Conn) error { func setDontRoute(c net.Conn) error {
// as c is an interface for testability reason we're checking here if the concrete type
// is a real TCP connection as only that supports setting SetDontRoute()
switch c.(type) { switch c.(type) {
case *tcp.Conn: case *tcp.Conn:
return c.(*tcp.Conn).SetDontRoute()
default: default:
return nil return nil
} }
return c.(*tcp.Conn).SetDontRoute()
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment