-func register(tracker string, tr *TrackerRegistration) error {
- conn, err := net.Dial("udp", tracker)
+// RealDialer is the real implementation of the Dialer interface
+type RealDialer struct{}
+
+func (d *RealDialer) Dial(network, address string) (net.Conn, error) {
+ return net.Dial(network, address)
+}
+
+func register(dialer Dialer, tracker string, tr io.Reader) error {
+ conn, err := dialer.Dial("udp", tracker)