1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-28 23:00:26 +08:00

完善注释

This commit is contained in:
fumiama
2021-10-25 19:29:59 +08:00
parent e29d5b2f48
commit fe6abd3898
10 changed files with 132 additions and 61 deletions

View File

@@ -2,6 +2,7 @@ package link
import "net"
// Accept 判断是否应当接受 ip 发来的包
func (l *Link) Accept(ip net.IP) bool {
for _, cidr := range l.allowedips {
if cidr.Contains(ip) {
@@ -11,6 +12,12 @@ func (l *Link) Accept(ip net.IP) bool {
return false
}
func NextHop(ip net.IP) *Link {
return nil
// IsToMe 判断是否是发给自己的包
func (l *Link) IsToMe(ip net.IP) bool {
return ip.Equal(me)
}
// NextHop 得到前往 ip 的下一跳的 link
func (l *Link) NextHop(ip net.IP) *Link {
return l
}