mirror of
https://github.com/codecat/go-enet.git
synced 2025-12-07 13:39:48 +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)
|
||||
|
||||
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{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue