mirror of
https://github.com/codecat/go-enet.git
synced 2025-12-08 05:59:47 +00:00
Add GetPort to Address
This commit is contained in:
parent
4f646b4212
commit
4f738345f9
1 changed files with 5 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ type Address interface {
|
||||||
SetPort(port uint16)
|
SetPort(port uint16)
|
||||||
|
|
||||||
String() string
|
String() string
|
||||||
|
GetPort() uint16
|
||||||
}
|
}
|
||||||
|
|
||||||
type enetAddress struct {
|
type enetAddress struct {
|
||||||
|
|
@ -49,6 +50,10 @@ func (addr *enetAddress) String() string {
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (addr *enetAddress) GetPort() uint16 {
|
||||||
|
return uint16(addr.cAddr.port)
|
||||||
|
}
|
||||||
|
|
||||||
// NewAddress creates a new address
|
// NewAddress creates a new address
|
||||||
func NewAddress(ip string, port uint16) Address {
|
func NewAddress(ip string, port uint16) Address {
|
||||||
ret := enetAddress{}
|
ret := enetAddress{}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue