Chore: Listener should not expose original net.Listener
This commit is contained in:
@ -12,9 +12,9 @@ import (
|
||||
)
|
||||
|
||||
type Listener struct {
|
||||
net.Listener
|
||||
address string
|
||||
closed bool
|
||||
listener net.Listener
|
||||
address string
|
||||
closed bool
|
||||
}
|
||||
|
||||
func New(addr string, in chan<- C.ConnContext) (*Listener, error) {
|
||||
@ -42,7 +42,7 @@ func New(addr string, in chan<- C.ConnContext) (*Listener, error) {
|
||||
|
||||
func (l *Listener) Close() {
|
||||
l.closed = true
|
||||
l.Listener.Close()
|
||||
l.listener.Close()
|
||||
}
|
||||
|
||||
func (l *Listener) Address() string {
|
||||
|
@ -12,9 +12,9 @@ import (
|
||||
)
|
||||
|
||||
type UDPListener struct {
|
||||
net.PacketConn
|
||||
address string
|
||||
closed bool
|
||||
packetConn net.PacketConn
|
||||
address string
|
||||
closed bool
|
||||
}
|
||||
|
||||
func NewUDP(addr string, in chan<- *inbound.PacketAdapter) (*UDPListener, error) {
|
||||
@ -48,7 +48,7 @@ func NewUDP(addr string, in chan<- *inbound.PacketAdapter) (*UDPListener, error)
|
||||
|
||||
func (l *UDPListener) Close() error {
|
||||
l.closed = true
|
||||
return l.PacketConn.Close()
|
||||
return l.packetConn.Close()
|
||||
}
|
||||
|
||||
func (l *UDPListener) Address() string {
|
||||
|
Reference in New Issue
Block a user