github.com/aporeto-inc/trireme-lib@v10.358.0+incompatible/controller/internal/enforcer/dnsproxy/dnsproxy.go (about) 1 package dnsproxy 2 3 import ( 4 "context" 5 "net" 6 7 "go.aporeto.io/enforcerd/trireme-lib/controller/pkg/pucontext" 8 "go.aporeto.io/enforcerd/trireme-lib/policy" 9 ) 10 11 // DNSProxy defines an interface that trireme uses for Dns Proxy 12 type DNSProxy interface { 13 14 // StartDNSServer starts the dns server on the port provided for contextID 15 StartDNSServer(ctx context.Context, contextID, port string) error 16 17 // Enforce starts enforcing policies for the given policy.PUInfo. 18 Enforce(ctx context.Context, contextID string, puInfo *policy.PUInfo) error 19 20 // Unenforce stops enforcing policy for the given IP. 21 Unenforce(ctx context.Context, contextID string) error 22 23 // SyncWithPlatformCache is only needed in Windows 24 SyncWithPlatformCache(ctx context.Context, pctx *pucontext.PUContext) error 25 26 // HandleDNSResponsePacket is only needed in Windows 27 HandleDNSResponsePacket(dnsPacketData []byte, sourceIP net.IP, sourcePort uint16, destIP net.IP, destPort uint16, puFromContextID func(string) (*pucontext.PUContext, error)) error 28 }