Add GetPort to Address

This commit is contained in:
Alexander Pardes 2020-12-12 14:37:48 -08:00
parent 4f646b4212
commit 4f738345f9

View file

@ -14,6 +14,7 @@ type Address interface {
SetPort(port uint16)
String() string
GetPort() uint16
}
type enetAddress struct {
@ -49,6 +50,10 @@ func (addr *enetAddress) String() string {
return ret
}
func (addr *enetAddress) GetPort() uint16 {
return uint16(addr.cAddr.port)
}
// NewAddress creates a new address
func NewAddress(ip string, port uint16) Address {
ret := enetAddress{}