text
stringlengths
9
39.2M
dir
stringlengths
25
226
lang
stringclasses
163 values
created_date
timestamp[s]
updated_date
timestamp[s]
repo_name
stringclasses
751 values
repo_full_name
stringclasses
752 values
star
int64
1.01k
183k
len_tokens
int64
1
18.5M
```go package querylog import ( "slices" "strconv" "strings" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/golibs/log" "github.com/miekg/dns" "golang.org/x/net/idna" ) // TODO(a.garipov): Use a proper structured ap...
/content/code_sandbox/internal/querylog/json.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,296
```go package querylog import ( "encoding/json" "fmt" "math" "net" "net/http" "net/url" "slices" "strconv" "strings" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghalg" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardT...
/content/code_sandbox/internal/querylog/http.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
2,928
```go package querylog import ( "fmt" "net" "testing" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/golibs/testutil" "github.com/AdguardTeam/golibs/timeutil" "github.com/miekg/dns" "github.com/stretchr/testify/assert" "gi...
/content/code_sandbox/internal/querylog/qlog_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
3,601
```go package querylog import "github.com/AdguardTeam/AdGuardHome/internal/whois" // Client is the information required by the query log to match against clients // during searches. type Client struct { WHOIS *whois.Info `json:"whois,omitempty"` Name string `json:"name"` DisallowedRule stri...
/content/code_sandbox/internal/querylog/client.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
205
```go package querylog import ( "fmt" "net" "path/filepath" "sync" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/golibs/container" "github.com/AdguardTeam/golib...
/content/code_sandbox/internal/querylog/querylog.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,113
```go // Package querylog provides query log functions and interfaces. package querylog import ( "fmt" "os" "sync" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/golibs/container" "github.com/AdguardTeam/golibs/errors...
/content/code_sandbox/internal/querylog/qlog.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,650
```go package querylog import ( "net" "time" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" "github.com/miekg/dns" ) // logEntry represents a single entry in the file. type logEntry struct { // client is the found client infor...
/content/code_sandbox/internal/querylog/entry.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
577
```go package querylog import ( "encoding/base64" "encoding/json" "fmt" "io" "net" "net/netip" "strings" "time" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/AdGuardHome/internal/filtering/rulelist" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log...
/content/code_sandbox/internal/querylog/decode.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
4,354
```go package querylog import ( "net" "testing" "time" "github.com/AdguardTeam/golibs/timeutil" "github.com/miekg/dns" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestQueryLog_Search_findClient(t *testing.T) { const knownClientID = "client-1" const knownClientName = "Kn...
/content/code_sandbox/internal/querylog/search_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
601
```go package querylog import ( "encoding/binary" "fmt" "io" "math" "net" "os" "strings" "testing" "time" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/testutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) // prepareTestFile prepares one test quer...
/content/code_sandbox/internal/querylog/qlogfile_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
2,414
```go package querylog import ( "fmt" "io" "slices" "time" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" ) // client finds the client info, if any, by its ClientID and IP address, // optionally checking the provided cache. It will use the IP address // regardless of if the IP anon...
/content/code_sandbox/internal/querylog/search.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
2,357
```go package querylog import ( "io" "testing" "time" "github.com/AdguardTeam/golibs/testutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) // newTestQLogReader creates new *qLogReader for tests and registers the // required cleanup functions. func newTestQLogReader(t *testing.T...
/content/code_sandbox/internal/querylog/qlogreader_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,029
```go package querylog import ( "fmt" "strings" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/golibs/stringutil" ) type criterionType int const ( // ctTerm is for searching by the domain name, the client's IP address, // the client's ID or the client's name. The domain name ...
/content/code_sandbox/internal/querylog/searchcriterion.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,539
```go package querylog import ( "bytes" "encoding/json" "fmt" "os" "time" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" ) // flushLogBuffer flushes the current buffer to file and resets the current // buffer. func (l *queryLog) flushLogBuffer() (err error) { defer func() { err = ...
/content/code_sandbox/internal/querylog/querylogfile.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,190
```go package stats import ( "bytes" "encoding/binary" "encoding/gob" "fmt" "slices" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" "go.etcd.io/bbolt" "golang.org/x/exp/maps" ) const ( // maxDomains is the max number ...
/content/code_sandbox/internal/stats/unit.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
4,783
```go // HTTP request handlers for accessing statistics data and configuration settings package stats import ( "encoding/json" "net/http" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghalg" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "gith...
/content/code_sandbox/internal/stats/http.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,766
```go package stats import ( "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestUnit_Deserialize(t *testing.T) { testCases := []struct { db *unitDB name string want unit }{{ name: "empty", want: unit{ domains: map[string]uint64{}, blocked...
/content/code_sandbox/internal/stats/unit_internal_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,565
```go package stats_test import ( "encoding/json" "fmt" "net" "net/http" "net/http/httptest" "path/filepath" "sync/atomic" "testing" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/AdGuardHome/internal/stats" "github.com/AdguardTeam/golibs/netutil" "github.com/AdguardT...
/content/code_sandbox/internal/stats/stats_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
2,335
```go // Package stats provides units for managing statistics of the filtering DNS // server. package stats import ( "fmt" "io" "net/netip" "os" "sync" "sync/atomic" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/goli...
/content/code_sandbox/internal/stats/stats.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
3,968
```go package stats import ( "bytes" "encoding/json" "net/http" "net/http/httptest" "path/filepath" "testing" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghalg" "github.com/AdguardTeam/golibs/testutil" "github.com/AdguardTeam/golibs/timeutil" "github.com/stretchr/testify/assert" "github.com/stret...
/content/code_sandbox/internal/stats/http_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
903
```go package aghalg import ( "slices" ) // SortedMap is a map that keeps elements in order with internal sorting // function. Must be initialised by the [NewSortedMap]. type SortedMap[K comparable, V any] struct { vals map[K]V cmp func(a, b K) (res int) keys []K } // NewSortedMap initializes the new instance ...
/content/code_sandbox/internal/aghalg/sortedmap.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
556
```go package stats import ( "fmt" "path/filepath" "sync" "sync/atomic" "testing" "time" "github.com/AdguardTeam/golibs/testutil" "github.com/AdguardTeam/golibs/timeutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestStats_races(t *testing.T) { var r uint32 idGen :...
/content/code_sandbox/internal/stats/stats_internal_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,113
```go package aghalg import ( "bytes" "encoding/json" "fmt" "github.com/AdguardTeam/golibs/mathutil" ) // NullBool is a nullable boolean. Use these in JSON requests and responses // instead of pointers to bool. type NullBool uint8 // NullBool values const ( NBNull NullBool = iota NBTrue NBFalse ) // String...
/content/code_sandbox/internal/aghalg/nullbool.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
408
```go // Package aghalg contains common generic algorithms and data structures. // // TODO(a.garipov): Move parts of this into golibs. package aghalg import ( "fmt" "slices" "golang.org/x/exp/constraints" ) // CoalesceSlice returns the first non-zero value. It is named after function // COALESCE in SQL. If valu...
/content/code_sandbox/internal/aghalg/aghalg.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
434
```go package aghalg_test import ( "encoding/json" "testing" "github.com/AdguardTeam/AdGuardHome/internal/aghalg" "github.com/AdguardTeam/golibs/testutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestNullBool_MarshalJSON(t *testing.T) { testCases := []struct { name ...
/content/code_sandbox/internal/aghalg/nullbool_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
729
```go package aghalg import ( "strings" "testing" "github.com/stretchr/testify/assert" ) func TestNewSortedMap(t *testing.T) { var m SortedMap[string, int] letters := []string{} for i := range 10 { r := string('a' + rune(i)) letters = append(letters, r) } t.Run("create_and_fill", func(t *testing.T) { ...
/content/code_sandbox/internal/aghalg/sortedmap_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
503
```go package dhcpsvc import ( "net/netip" "strconv" "testing" "github.com/AdguardTeam/golibs/testutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestNewIPRange(t *testing.T) { start4 := netip.MustParseAddr("0.0.0.1") end4 := netip.MustParseAddr("0.0.0.3") start6 := n...
/content/code_sandbox/internal/dhcpsvc/iprange_internal_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,486
```go package dhcpsvc import ( "context" "encoding/json" "fmt" "io/fs" "net" "net/netip" "os" "slices" "strings" "time" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/logutil/slogutil" "github.com/google/renameio/v2/maybe" ) // dataVersion is the current version of the stored DHCP...
/content/code_sandbox/internal/dhcpsvc/db.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,432
```go package dhcpsvc import ( "net" "net/netip" "slices" "time" ) // Lease is a DHCP lease. // // TODO(e.burkov): Consider moving it to [agh], since it also may be needed in // [websvc]. // // TODO(e.burkov): Add validation method. type Lease struct { // IP is the IP address leased to the client. IP netip.Ad...
/content/code_sandbox/internal/dhcpsvc/lease.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
255
```go package dhcpsvc // DatabasePerm is the permissions for the test database file. const DatabasePerm = databasePerm ```
/content/code_sandbox/internal/dhcpsvc/db_internal_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
25
```go package dhcpsvc import ( "encoding/binary" "fmt" "math" "math/big" "net/netip" "github.com/AdguardTeam/golibs/errors" ) // ipRange is an inclusive range of IP addresses. A zero range doesn't contain // any IP addresses. // // It is safe for concurrent use. type ipRange struct { start netip.Addr end ...
/content/code_sandbox/internal/dhcpsvc/iprange.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
795
```go package dhcpsvc import ( "fmt" "github.com/AdguardTeam/golibs/errors" ) const ( // errNilConfig is returned when a nil config met. errNilConfig errors.Error = "config is nil" // errNoInterfaces is returned when no interfaces found in configuration. errNoInterfaces errors.Error = "no interfaces specified...
/content/code_sandbox/internal/dhcpsvc/errors.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
135
```go package dhcpsvc import ( "context" "fmt" "log/slog" "net/netip" "slices" "time" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/netutil" "github.com/google/gopacket/layers" ) // IPv6Config is the interface-specific configuration for DHCPv6. type IPv6Config struct { // RangeStart...
/content/code_sandbox/internal/dhcpsvc/v6.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,332
```go package dhcpsvc_test import ( "io/fs" "net/netip" "os" "path" "path/filepath" "strings" "testing" "time" "github.com/AdguardTeam/AdGuardHome/internal/dhcpsvc" "github.com/AdguardTeam/golibs/testutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) // testdata is a files...
/content/code_sandbox/internal/dhcpsvc/server_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
4,716
```go package dhcpsvc import ( "fmt" "net/netip" "slices" "strings" ) // leaseIndex is the set of leases indexed by their identifiers for quick // lookup. type leaseIndex struct { // byAddr is a lookup shortcut for leases by their IP addresses. byAddr map[netip.Addr]*Lease // byName is a lookup shortcut for l...
/content/code_sandbox/internal/dhcpsvc/leaseindex.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,055
```go package dhcpsvc import ( "context" "fmt" "log/slog" "net" "net/netip" "slices" "time" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/netutil" "github.com/google/gopacket/layers" ) // IPv4Config is the interface-specific configuration for DHCPv4. type IPv4Config struct { // Gat...
/content/code_sandbox/internal/dhcpsvc/v4.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
3,447
```go package dhcpsvc import ( "context" "fmt" "log/slog" "net" "net/netip" "sync" "sync/atomic" "time" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/mapsutil" ) // DHCPServer is a DHCP server for both IPv4 and IPv6 address families. type DHCPServer struct { // enabled indicates wh...
/content/code_sandbox/internal/dhcpsvc/server.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
2,484
```go package dhcpsvc import ( "fmt" "log/slog" "os" "time" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/mapsutil" "github.com/AdguardTeam/golibs/netutil" ) // Config is the configuration for the DHCP service. type Config struct { // Interfaces stores configurations of DHCP server sp...
/content/code_sandbox/internal/dhcpsvc/config.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
715
```go // Package dhcpsvc contains the AdGuard Home DHCP service. // // TODO(e.burkov): Add tests. package dhcpsvc import ( "context" "net" "net/netip" "github.com/AdguardTeam/AdGuardHome/internal/next/agh" ) const ( // keyInterface is the key for logging the network interface name. keyInterface = "iface" // ...
/content/code_sandbox/internal/dhcpsvc/dhcpsvc.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,116
```go package dhcpsvc import ( "net/netip" "testing" "time" "github.com/AdguardTeam/golibs/logutil/slogutil" "github.com/AdguardTeam/golibs/testutil" "github.com/google/gopacket/layers" "github.com/stretchr/testify/assert" ) func TestIPv4Config_Options(t *testing.T) { oneIP, otherIP := netip.MustParseAddr("1...
/content/code_sandbox/internal/dhcpsvc/v4_internal_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
770
```go package dhcpsvc_test import ( "net" "net/netip" "time" "github.com/AdguardTeam/AdGuardHome/internal/dhcpsvc" "github.com/AdguardTeam/golibs/logutil/slogutil" "github.com/stretchr/testify/require" ) // testLocalTLD is a common local TLD for tests. const testLocalTLD = "local" // testTimeout is a common t...
/content/code_sandbox/internal/dhcpsvc/dhcpsvc_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
618
```go package dhcpsvc_test import ( "path/filepath" "testing" "github.com/AdguardTeam/AdGuardHome/internal/dhcpsvc" "github.com/AdguardTeam/golibs/testutil" ) func TestConfig_Validate(t *testing.T) { leasesPath := filepath.Join(t.TempDir(), "leases.json") testCases := []struct { name string conf ...
/content/code_sandbox/internal/dhcpsvc/config_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
695
```go //go:build unix package aghrenameio import ( "io/fs" "github.com/google/renameio/v2" ) // pendingFile is a wrapper around [*renameio.PendingFile] making it an // [io.WriteCloser]. type pendingFile struct { file *renameio.PendingFile } // type check var _ PendingFile = pendingFile{} // Cleanup implements ...
/content/code_sandbox/internal/aghrenameio/renameio_unix.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
296
```go package aghrenameio_test import ( "io/fs" "os" "path/filepath" "testing" "github.com/AdguardTeam/AdGuardHome/internal/aghrenameio" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/testutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) // testPerm is...
/content/code_sandbox/internal/aghrenameio/renameio_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
576
```go package dhcpsvc import ( "fmt" "log/slog" "net" "time" ) // macKey contains hardware address as byte array of 6, 8, or 20 bytes. // // TODO(e.burkov): Move to aghnet or even to netutil. type macKey any // macToKey converts mac into macKey, which is used as the key for the lease // maps. mac must be a val...
/content/code_sandbox/internal/dhcpsvc/interface.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
761
```go //go:build windows package aghrenameio import ( "fmt" "io/fs" "os" "path/filepath" "github.com/AdguardTeam/golibs/errors" ) // pendingFile is a wrapper around [*os.File] calling [os.Rename] in its Close // method. type pendingFile struct { file *os.File targetPath string } // type check var _ Pe...
/content/code_sandbox/internal/aghrenameio/renameio_windows.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
462
```go // Package aghrenameio is a wrapper around package github.com/google/renameio/v2 // that provides a similar stream-based API for both Unix and Windows systems. // While the Windows API is not technically atomic, it still provides a // consistent stream-based interface, and atomic renames of files do not seem to /...
/content/code_sandbox/internal/aghrenameio/renameio.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
443
```go package whois_test import ( "context" "io" "net" "net/netip" "testing" "time" "github.com/AdguardTeam/AdGuardHome/internal/whois" "github.com/AdguardTeam/golibs/testutil/fakenet" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestDefault_Process(t *testing.T) { con...
/content/code_sandbox/internal/whois/whois_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
989
```go // Package whois provides WHOIS functionality. package whois import ( "bytes" "cmp" "context" "fmt" "io" "net" "net/netip" "strconv" "strings" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/ioutil" "github.com/Adgua...
/content/code_sandbox/internal/whois/whois.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
2,723
```go // Package schedule provides types for scheduling. package schedule import ( "encoding/json" "fmt" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/timeutil" "gopkg.in/yaml.v3" ) // Weekly is a schedule for one week. Each...
/content/code_sandbox/internal/schedule/schedule.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
2,767
```go package schedule import ( "encoding/json" "testing" "time" "github.com/AdguardTeam/golibs/testutil" "github.com/AdguardTeam/golibs/timeutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "gopkg.in/yaml.v3" ) func TestWeekly_Contains(t *testing.T) { baseTime := time.Date(20...
/content/code_sandbox/internal/schedule/schedule_internal_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
3,495
```go package aghnet import ( "fmt" "io" "io/fs" "net/netip" "path" "sync/atomic" "github.com/AdguardTeam/AdGuardHome/internal/aghos" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/hostsfile" "github.com/AdguardTeam/golibs/log" ) // hostsContainerPrefix is a prefix for logging and wr...
/content/code_sandbox/internal/aghnet/hostscontainer.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,698
```go package aghnet import ( "strings" ) // NormalizeDomain returns a lowercased version of host without the final dot, // unless host is ".", in which case it returns it unchanged. That is a special // case that to allow matching queries like: // // dig IN NS '.' func NormalizeDomain(host string) (norm string) { ...
/content/code_sandbox/internal/aghnet/addr.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
96
```go // Package aghnet contains some utilities for networking. package aghnet import ( "bytes" "context" "encoding/json" "fmt" "io" "net" "net/netip" "net/url" "strings" "syscall" "github.com/AdguardTeam/AdGuardHome/internal/aghos" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/golib...
/content/code_sandbox/internal/aghnet/net.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
2,778
```go //go:build freebsd package aghnet import ( "io/fs" "testing" "testing/fstest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestIfaceHasStaticIP(t *testing.T) { const ( ifaceName = `em0` rcConf = "etc/rc.conf" ) testCases := []struct { name string ro...
/content/code_sandbox/internal/aghnet/net_freebsd_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
669
```go //go:build darwin package aghnet import ( "bufio" "bytes" "fmt" "io" "regexp" "github.com/AdguardTeam/AdGuardHome/internal/aghos" "github.com/AdguardTeam/golibs/errors" ) // hardwarePortInfo contains information about the current state of the internet // connection obtained from macOS networksetup. typ...
/content/code_sandbox/internal/aghnet/net_darwin.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,256
```go //go:build darwin || freebsd || linux || openbsd package aghnet import ( "io" "syscall" "github.com/AdguardTeam/golibs/errors" ) // closePortChecker closes c. c must be non-nil. func closePortChecker(c io.Closer) (err error) { return c.Close() } func isAddrInUse(err syscall.Errno) (ok bool) { return er...
/content/code_sandbox/internal/aghnet/net_unix.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
103
```go package aghnet import ( "bytes" "encoding/json" "fmt" "io/fs" "net" "net/netip" "strings" "testing" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/netutil" "github.com/AdguardTeam/golibs/testutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) /...
/content/code_sandbox/internal/aghnet/net_internal_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
2,814
```go //go:build freebsd package aghnet import ( "bufio" "fmt" "io" "strings" "github.com/AdguardTeam/AdGuardHome/internal/aghos" "github.com/AdguardTeam/golibs/netutil" ) func ifaceHasStaticIP(ifaceName string) (ok bool, err error) { const rcConfFilename = "etc/rc.conf" walker := aghos.FileWalker(interfac...
/content/code_sandbox/internal/aghnet/net_freebsd.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
378
```go package aghnet import ( "fmt" "net" "time" "github.com/AdguardTeam/golibs/log" ) // IPVersion is a alias for int for documentation purposes. Use it when the // integer means IP version. type IPVersion = int // IP version constants. const ( IPVersion4 IPVersion = 4 IPVersion6 IPVersion = 6 ) // NetIfac...
/content/code_sandbox/internal/aghnet/interfaces.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
899
```go //go:build linux package aghnet import ( "bufio" "fmt" "io" "net/netip" "os" "strings" "github.com/AdguardTeam/AdGuardHome/internal/aghos" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/stringutil" "github.com/google/renameio/v2/maybe" "gol...
/content/code_sandbox/internal/aghnet/net_linux.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,504
```go package aghnet import ( "net" "testing" "github.com/AdguardTeam/golibs/netutil" "github.com/stretchr/testify/assert" ) func TestIPMut(t *testing.T) { testIPs := []net.IP{{ 127, 0, 0, 1, }, { 192, 168, 0, 1, }, { 8, 8, 8, 8, }} t.Run("nil_no_mut", func(t *testing.T) { ipmut := NewIPMut(nil) ...
/content/code_sandbox/internal/aghnet/ipmut_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
275
```go package aghnet_test import ( "net" "net/netip" "net/url" "testing" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/golibs/netutil" "github.com/AdguardTeam/golibs/testutil" "github.com/stretchr/testify/assert" ) func TestMain(m *testing.M) { testutil.DiscardLogOutput(m) } ...
/content/code_sandbox/internal/aghnet/net_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
738
```go //go:build darwin || freebsd || openbsd package aghnet import "github.com/AdguardTeam/AdGuardHome/internal/aghos" func canBindPrivilegedPorts() (can bool, err error) { return aghos.HaveAdminRights() } ```
/content/code_sandbox/internal/aghnet/net_bsd.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
61
```go //go:build linux package aghnet import ( "net" "github.com/AdguardTeam/golibs/netutil" "github.com/insomniacslk/dhcp/dhcpv4/nclient4" ) // listenPacketReusable announces on the local network address additionally // configuring the socket to have a reusable binding. func listenPacketReusable(ifaceName, netw...
/content/code_sandbox/internal/aghnet/interfaces_linux.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
165
```go //go:build windows package aghnet import "github.com/AdguardTeam/AdGuardHome/internal/aghos" func checkOtherDHCP(ifaceName string) (ok4, ok6 bool, err4, err6 error) { return false, false, aghos.Unsupported("CheckIfOtherDHCPServersPresentV4"), aghos.Unsupported("CheckIfOtherDHCPServersPresentV6") } ```
/content/code_sandbox/internal/aghnet/dhcp_windows.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
96
```go //go:build openbsd package aghnet import ( "bufio" "fmt" "io" "strings" "github.com/AdguardTeam/AdGuardHome/internal/aghos" "github.com/AdguardTeam/golibs/netutil" ) func ifaceHasStaticIP(ifaceName string) (ok bool, err error) { filename := fmt.Sprintf("etc/hostname.%s", ifaceName) return aghos.FileW...
/content/code_sandbox/internal/aghnet/net_openbsd.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
268
```go //go:build darwin || freebsd || linux || openbsd package aghnet import ( "bytes" "fmt" "net" "net/netip" "os" "time" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/netutil" "github.com/insomniacslk/dhcp/dhcpv4" "github.com/insomniacslk/dhcp/...
/content/code_sandbox/internal/aghnet/dhcp_unix.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
2,618
```go package aghnet import ( "net" "sync/atomic" ) // IPMutFunc is the signature of a function which modifies the IP address // instance. It should be safe for concurrent use. type IPMutFunc func(ip net.IP) // nopIPMutFunc is the IPMutFunc that does nothing. func nopIPMutFunc(net.IP) {} // IPMut is a type-safe ...
/content/code_sandbox/internal/aghnet/ipmut.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
284
```go //go:build windows package aghnet import ( "io" "syscall" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghos" "github.com/AdguardTeam/golibs/errors" "golang.org/x/sys/windows" ) func canBindPrivilegedPorts() (can bool, err error) { return true, nil } func ifaceHasStaticIP(string) (ok bool, err ...
/content/code_sandbox/internal/aghnet/net_windows.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
281
```go package aghnet import ( "net/netip" "strings" ) // GenerateHostname generates the hostname from ip. In case of using IPv4 the // result should be like: // // 192-168-10-1 // // In case of using IPv6, the result is like: // // ff80-f076-0000-0000-0000-0000-0000-0010 // // ip must be either an IPv4 or an IPv6....
/content/code_sandbox/internal/aghnet/hostgen.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
194
```go package aghnet import ( "io/fs" "testing" "testing/fstest" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/testutil" "github.com/AdguardTeam/golibs/testutil/fakefs" "github.com/stretchr/testify/assert" ) func TestIfaceHasStaticIP(t *testing.T) { testCases := []struct { name ...
/content/code_sandbox/internal/aghnet/net_darwin_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
2,175
```go package aghnet import ( "slices" "strings" "github.com/AdguardTeam/urlfilter" "github.com/AdguardTeam/urlfilter/filterlist" ) // IgnoreEngine contains the list of rules for ignoring hostnames and matches // them. // // TODO(s.chzhen): Move all urlfilter stuff to aghfilter. type IgnoreEngine struct { // e...
/content/code_sandbox/internal/aghnet/ignore.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
357
```go package aghnet import ( "io/fs" "path" "testing" "testing/fstest" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/testutil/fakefs" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) const nl = "\n" func TestHostsContainer_PathsToPatterns(t *testing.T) { ...
/content/code_sandbox/internal/aghnet/hostscontainer_internal_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
623
```go //go:build openbsd package aghnet import ( "fmt" "io/fs" "testing" "testing/fstest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestIfaceHasStaticIP(t *testing.T) { const ifaceName = "em0" confFile := fmt.Sprintf("etc/hostname.%s", ifaceName) testCases := []str...
/content/code_sandbox/internal/aghnet/net_openbsd_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
475
```go //go:build linux package aghnet import ( "io/fs" "testing" "testing/fstest" "github.com/AdguardTeam/golibs/testutil" "github.com/stretchr/testify/assert" ) func TestHasStaticIP(t *testing.T) { const ifaceName = "wlan0" const ( dhcpcd = "etc/dhcpcd.conf" netifaces = "etc/network/interfaces" ) ...
/content/code_sandbox/internal/aghnet/net_linux_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,049
```go package aghnet_test import ( "testing" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/stretchr/testify/require" ) func TestIgnoreEngine_Has(t *testing.T) { hostnames := []string{ "*.example.com", "example.com", "|.^", } engine, err := aghnet.NewIgnoreEngine(hostnames) require.No...
/content/code_sandbox/internal/aghnet/ignore_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
245
```go package aghnet // CheckOtherDHCP tries to discover another DHCP server in the network. func CheckOtherDHCP(ifaceName string) (ok4, ok6 bool, err4, err6 error) { return checkOtherDHCP(ifaceName) } ```
/content/code_sandbox/internal/aghnet/dhcp.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
57
```go package aghnet import ( "net/netip" "testing" "github.com/stretchr/testify/assert" ) func TestGenerateHostName(t *testing.T) { t.Run("valid", func(t *testing.T) { testCases := []struct { name string want string ip netip.Addr }{{ name: "good_ipv4", want: "127-0-0-1", ip: netip.Must...
/content/code_sandbox/internal/aghnet/hostgen_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
294
```go package aghnet_test import ( "net/netip" "path" "sync/atomic" "testing" "testing/fstest" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/AdGuardHome/internal/aghtest" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/hostsfile" "github.com/Adgua...
/content/code_sandbox/internal/aghnet/hostscontainer_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,678
```go //go:build darwin || freebsd || openbsd package aghnet import ( "context" "net" "os" "syscall" "github.com/AdguardTeam/golibs/errors" "golang.org/x/sys/unix" ) // reuseAddrCtrl is the function to be set to net.ListenConfig.Control. It // configures the socket to have a reusable port binding. func reuse...
/content/code_sandbox/internal/aghnet/interfaces_bsd.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
270
```go package dnsforward import ( "encoding/binary" "fmt" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" "github.com/miekg/dns" ) // type check var _ proxy.BeforeRequestHandler = (*Server)(...
/content/code_sandbox/internal/dnsforward/beforerequest.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
890
```go package aghnet import ( "net" "testing" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/testutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) // fakeIface is a stub implementation of aghnet.NetIface to simplify testing. type fakeIface struct { err ...
/content/code_sandbox/internal/aghnet/interfaces_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,998
```go package dnsforward import ( "fmt" "net" "slices" "strings" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/urlfilter/rules" "github.com/miekg/dns" ) // clientRequestFilteringSettings looks up client filtering settings using the // clie...
/content/code_sandbox/internal/dnsforward/filter.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,642
```go package dnsforward import ( "fmt" "slices" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghnet" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/netutil" "github.com/AdguardTeam/golibs/stringutil...
/content/code_sandbox/internal/dnsforward/upstreams.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,335
```go package dnsforward import ( "net" "testing" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/urlfilter/rules" "github.com/miekg/dns" "github.com/stretchr/testify/assert" ) func TestGenAnswerHTTPS_andSVCB(t *testing.T) { // Preconditions. s := createTestServer(t, &filteri...
/content/code_sandbox/internal/dnsforward/svcbmsg_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,363
```go package dnsforward import ( "context" "fmt" "net" "net/netip" "strconv" "time" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/netutil" ) // DialContext is an [aghnet.DialContextFunc] that uses s to resolve hostnames. // addr should be a valid ...
/content/code_sandbox/internal/dnsforward/dialcontext.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
450
```go package dnsforward import ( "fmt" "net/netip" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/urlfilter/rules" "github.com/miekg/dns" ) // filterDNSRewriteR...
/content/code_sandbox/internal/dnsforward/dnsrewrite.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,311
```go package dnsforward import ( "cmp" "encoding/binary" "net" "net/netip" "strings" "time" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/golibs/netutil" "github.com/miekg/dns" ) // To transfer i...
/content/code_sandbox/internal/dnsforward/process.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
4,885
```go package dnsforward import ( "cmp" "net" "net/netip" "testing" "github.com/AdguardTeam/AdGuardHome/internal/aghtest" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/golibs/logutil/slogutil"...
/content/code_sandbox/internal/dnsforward/process_internal_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
6,708
```go package dnsforward import ( "fmt" "net" "os" "strings" "github.com/AdguardTeam/AdGuardHome/internal/ipset" "github.com/AdguardTeam/golibs/errors" "github.com/AdguardTeam/golibs/log" "github.com/miekg/dns" ) // ipsetCtx is the ipset context. ipsetMgr can be nil. type ipsetCtx struct { ipsetMgr ipset.M...
/content/code_sandbox/internal/dnsforward/ipset.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,010
```go package dnsforward import ( "net" "net/netip" "testing" "github.com/AdguardTeam/AdGuardHome/internal/aghtest" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/dnsproxy/upstream" "github.com/AdguardTeam/golibs/logutil/slogutil" "gith...
/content/code_sandbox/internal/dnsforward/filter_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
3,128
```go package dnsforward import ( "net/netip" "slices" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/urlfilter/rules" "github.com/miekg/dns" ) // TODO(e.burkov): Name all the methods by a [proxy.Mess...
/content/code_sandbox/internal/dnsforward/msg.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
3,511
```go package dnsforward import ( "net" "testing" "github.com/AdguardTeam/AdGuardHome/internal/aghtest" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/golibs/netutil" "github.com/AdguardTeam/golibs/testutil" "github.com/miekg/dns" "gith...
/content/code_sandbox/internal/dnsforward/dns64_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
3,070
```go package dnsforward import ( "cmp" "encoding/json" "fmt" "io" "net/http" "net/netip" "slices" "time" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/dnsproxy/upstream" "githu...
/content/code_sandbox/internal/dnsforward/http.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
6,279
```go package dnsforward import ( "encoding/json" "fmt" "net/http" "net/netip" "slices" "strings" "github.com/AdguardTeam/AdGuardHome/internal/aghalg" "github.com/AdguardTeam/AdGuardHome/internal/aghhttp" "github.com/AdguardTeam/golibs/container" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/...
/content/code_sandbox/internal/dnsforward/access.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
2,037
```go package dnsforward import ( "net" "net/netip" "github.com/AdguardTeam/dnsproxy/proxy" ) // setupDNS64 initializes DNS64 settings, the NAT64 prefixes in particular. If // the DNS64 feature is enabled and no prefixes are configured, the default // Well-Known Prefix is used, just like Section 5.2 of RFC 6147 ...
/content/code_sandbox/internal/dnsforward/dns64.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
435
```go package dnsforward import ( "encoding/base64" "net" "strconv" "github.com/AdguardTeam/golibs/log" "github.com/AdguardTeam/urlfilter/rules" "github.com/miekg/dns" ) // genAnswerHTTPS returns a properly initialized HTTPS resource record. // // See the comment on genAnswerSVCB for a list of current restrict...
/content/code_sandbox/internal/dnsforward/svcbmsg.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,557
```go package dnsforward import ( "net/netip" "testing" "github.com/AdguardTeam/urlfilter/rules" "github.com/miekg/dns" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func TestIsBlockedClientID(t *testing.T) { clientID := "client-1" clients := []string{clientID} a, err := newA...
/content/code_sandbox/internal/dnsforward/access_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
1,140
```go package dnsforward import ( "net" "testing" "github.com/AdguardTeam/AdGuardHome/internal/filtering" "github.com/AdguardTeam/dnsproxy/proxy" "github.com/AdguardTeam/golibs/netutil" "github.com/AdguardTeam/urlfilter/rules" "github.com/miekg/dns" "github.com/stretchr/testify/assert" "github.com/stretchr/t...
/content/code_sandbox/internal/dnsforward/dnsrewrite_test.go
go
2016-07-06T10:31:47
2024-08-16T18:17:06
AdGuardHome
AdguardTeam/AdGuardHome
24,082
2,087