Merge pull request #1 from alexpardes/master

Add GetPort to Address
This commit is contained in:
Melissa 2020-12-13 06:39:19 +01:00 committed by GitHub
commit 8c1bf6ac65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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{}