mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-24 17:41:29 +00:00
Prevent nil LocalAddr or RemoteAddr
This commit is contained in:
parent
50f5a76380
commit
0ef268637e
|
@ -143,7 +143,7 @@ func (c *GunConn) LocalAddr() net.Addr {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GunConn) RemoteAddr() net.Addr {
|
func (c *GunConn) RemoteAddr() net.Addr {
|
||||||
return nil
|
return M.Socksaddr{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GunConn) SetDeadline(t time.Time) error {
|
func (c *GunConn) SetDeadline(t time.Time) error {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"github.com/sagernet/sing/common/buf"
|
"github.com/sagernet/sing/common/buf"
|
||||||
"github.com/sagernet/sing/common/debug"
|
"github.com/sagernet/sing/common/debug"
|
||||||
E "github.com/sagernet/sing/common/exceptions"
|
E "github.com/sagernet/sing/common/exceptions"
|
||||||
|
M "github.com/sagernet/sing/common/metadata"
|
||||||
"github.com/sagernet/ws"
|
"github.com/sagernet/ws"
|
||||||
"github.com/sagernet/ws/wsutil"
|
"github.com/sagernet/ws/wsutil"
|
||||||
)
|
)
|
||||||
|
@ -232,14 +233,14 @@ func (c *EarlyWebsocketConn) Close() error {
|
||||||
|
|
||||||
func (c *EarlyWebsocketConn) LocalAddr() net.Addr {
|
func (c *EarlyWebsocketConn) LocalAddr() net.Addr {
|
||||||
if c.conn == nil {
|
if c.conn == nil {
|
||||||
return nil
|
return M.Socksaddr{}
|
||||||
}
|
}
|
||||||
return c.conn.LocalAddr()
|
return c.conn.LocalAddr()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *EarlyWebsocketConn) RemoteAddr() net.Addr {
|
func (c *EarlyWebsocketConn) RemoteAddr() net.Addr {
|
||||||
if c.conn == nil {
|
if c.conn == nil {
|
||||||
return nil
|
return M.Socksaddr{}
|
||||||
}
|
}
|
||||||
return c.conn.RemoteAddr()
|
return c.conn.RemoteAddr()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue