From de360ba9173dfd4782e3797d34167cd41dab9f71 Mon Sep 17 00:00:00 2001 From: aarshkshah1992 Date: Tue, 2 Feb 2021 12:55:42 +0530 Subject: [PATCH] refactor packages --- event/nattype.go | 23 +---------------------- network/nattype.go | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/event/nattype.go b/event/nattype.go index e3819246..a24eb1a1 100644 --- a/event/nattype.go +++ b/event/nattype.go @@ -2,27 +2,6 @@ package event import "github.com/libp2p/go-libp2p-core/network" -// NATTransportProtocol is the transport protocol for which the NAT Device Type has been determined. -type NATTransportProtocol int - -const ( - // NATTransportUDP means that the NAT Device Type has been determined for the UDP Protocol. - NATTransportUDP NATTransportProtocol = iota - // NATTransportTCP means that the NAT Device Type has been determined for the TCP Protocol. - NATTransportTCP -) - -func (n NATTransportProtocol) String() string { - switch n { - case 0: - return "UDP" - case 1: - return "TCP" - default: - return "unrecognized" - } -} - // EvtNATDeviceTypeChanged is an event struct to be emitted when the type of the NAT device changes for a Transport Protocol. // // Note: This event is meaningful ONLY if the AutoNAT Reachability is Private. @@ -30,7 +9,7 @@ func (n NATTransportProtocol) String() string { // this event ONLY if the Reachability on the `EvtLocalReachabilityChanged` is Private. type EvtNATDeviceTypeChanged struct { // TransportProtocol is the Transport Protocol for which the NAT Device Type has been determined. - TransportProtocol NATTransportProtocol + TransportProtocol network.NATTransportProtocol // NatDeviceType indicates the type of the NAT Device for the Transport Protocol. // Currently, it can be either a `Cone NAT` or a `Symmetric NAT`. Please see the detailed documentation // on `network.NATDeviceType` enumerations for a better understanding of what these types mean and diff --git a/network/nattype.go b/network/nattype.go index af9d25d2..bc95d687 100644 --- a/network/nattype.go +++ b/network/nattype.go @@ -35,3 +35,24 @@ func (r NATDeviceType) String() string { return "unrecognized" } } + +// NATTransportProtocol is the transport protocol for which the NAT Device Type has been determined. +type NATTransportProtocol int + +const ( + // NATTransportUDP means that the NAT Device Type has been determined for the UDP Protocol. + NATTransportUDP NATTransportProtocol = iota + // NATTransportTCP means that the NAT Device Type has been determined for the TCP Protocol. + NATTransportTCP +) + +func (n NATTransportProtocol) String() string { + switch n { + case 0: + return "UDP" + case 1: + return "TCP" + default: + return "unrecognized" + } +}