@ -300,9 +300,9 @@ var dummyPacket = []byte{
0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF ,
0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF ,
}
}
// Check TCP determines whether TCP traffic from srcIP to dstIP:dstPort
// Check determines whether traffic from srcIP to dstIP:dstPort is allowed
// is allowed .
// using protocol proto .
func ( f * Filter ) Check TCP ( srcIP , dstIP netip . Addr , dstPort uint16 ) Response {
func ( f * Filter ) Check ( srcIP , dstIP netip . Addr , dstPort uint16 , proto ipproto . Proto ) Response {
pkt := & packet . Parsed { }
pkt := & packet . Parsed { }
pkt . Decode ( dummyPacket ) // initialize private fields
pkt . Decode ( dummyPacket ) // initialize private fields
switch {
switch {
@ -319,12 +319,20 @@ func (f *Filter) CheckTCP(srcIP, dstIP netip.Addr, dstPort uint16) Response {
}
}
pkt . Src = netip . AddrPortFrom ( srcIP , 0 )
pkt . Src = netip . AddrPortFrom ( srcIP , 0 )
pkt . Dst = netip . AddrPortFrom ( dstIP , dstPort )
pkt . Dst = netip . AddrPortFrom ( dstIP , dstPort )
pkt . IPProto = ipproto . TCP
pkt . IPProto = proto
pkt . TCPFlags = packet . TCPSyn
if proto == ipproto . TCP {
pkt . TCPFlags = packet . TCPSyn
}
return f . RunIn ( pkt , 0 )
return f . RunIn ( pkt , 0 )
}
}
// CheckTCP determines whether TCP traffic from srcIP to dstIP:dstPort
// is allowed.
func ( f * Filter ) CheckTCP ( srcIP , dstIP netip . Addr , dstPort uint16 ) Response {
return f . Check ( srcIP , dstIP , dstPort , ipproto . TCP )
}
// CapsWithValues appends to base the capabilities that srcIP has talking
// CapsWithValues appends to base the capabilities that srcIP has talking
// to dstIP.
// to dstIP.
func ( f * Filter ) CapsWithValues ( srcIP , dstIP netip . Addr ) tailcfg . PeerCapMap {
func ( f * Filter ) CapsWithValues ( srcIP , dstIP netip . Addr ) tailcfg . PeerCapMap {