mirror of
https://github.com/ericyan/shield.git
synced 2025-09-26 19:21:11 +08:00
Remove origin check for peer UDP packets
Checking source IP address is far from enough to ensure authenticity, it is better to simply remove this and let the higher layer to worry about peer authentication.
This commit is contained in:
@@ -32,16 +32,7 @@ func New(local, remote string) (*Conn, error) {
|
||||
|
||||
// Read reads data from the peer.
|
||||
func (c *Conn) Read(b []byte) (int, error) {
|
||||
n, addr, err := c.ReadFromUDP(b)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
|
||||
// Discard packets not from the peer
|
||||
if addr.String() != c.remoteAddr.String() {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
n, _, err := c.ReadFromUDP(b)
|
||||
return n, err
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user