2020-04-30 10:15:09 +00:00
|
|
|
// Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2020-04-30 05:49:17 +00:00
|
|
|
package controlclient
|
|
|
|
|
|
|
|
import (
|
|
|
|
"tailscale.com/tailcfg"
|
|
|
|
"tailscale.com/wgengine/filter"
|
|
|
|
)
|
|
|
|
|
2020-11-10 05:33:41 +00:00
|
|
|
// Parse a backward-compatible FilterRule used by control's wire
|
|
|
|
// format, producing the most current filter format.
|
|
|
|
func (c *Direct) parsePacketFilter(pf []tailcfg.FilterRule) []filter.Match {
|
2020-08-20 17:36:19 +00:00
|
|
|
mm, err := filter.MatchesFromFilterRules(pf)
|
|
|
|
if err != nil {
|
|
|
|
c.logf("parsePacketFilter: %s\n", err)
|
2020-04-30 05:49:17 +00:00
|
|
|
}
|
|
|
|
return mm
|
|
|
|
}
|