Skip to content

Commit

Permalink
all: imp docs
Browse files Browse the repository at this point in the history
  • Loading branch information
schzhn committed Dec 6, 2023
1 parent fabaab0 commit a9ee2fe
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
5 changes: 4 additions & 1 deletion internal/ipset/ipset_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ func (m *manager) parseIpsetConfig(ipsetConf []string) (err error) {
// ipsetProps returns the properties of an ipset with the given name.
//
// Additional header data query. See https://github.com/AdguardTeam/AdGuardHome/issues/6420.
//
// TODO(s.chzhen): Use *props.
func (m *manager) ipsetProps(name string) (p props, err error) {
// The family doesn't seem to matter when we use a header query, so
// query only the IPv4 one.
Expand Down Expand Up @@ -328,7 +330,8 @@ func (m *manager) ipsetProps(name string) (p props, err error) {
}, nil
}

// ipsets returns currently known ipsets.
// ipsets returns ipset properties of currently known ipsets. It also makes an
// additional ipset header data query if needed.
func (m *manager) ipsets(names []string, currentlyKnown map[string]props) (sets []props, err error) {
for _, n := range names {
p, ok := currentlyKnown[n]
Expand Down
6 changes: 3 additions & 3 deletions internal/schedule/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,6 @@ func (r dayRange) toDayConfigJSON() (j *dayConfigJSON) {

// weeklyConfigJSON is the JSON configuration structure of Weekly.
type weeklyConfigJSON struct {
// TimeZone is the local time zone.
TimeZone string `json:"time_zone"`

// Days of the week.

Sunday *dayConfigJSON `json:"sun,omitempty"`
Expand All @@ -351,6 +348,9 @@ type weeklyConfigJSON struct {
Thursday *dayConfigJSON `json:"thu,omitempty"`
Friday *dayConfigJSON `json:"fri,omitempty"`
Saturday *dayConfigJSON `json:"sat,omitempty"`

// TimeZone is the local time zone.
TimeZone string `json:"time_zone"`
}

// dayConfigJSON is the JSON configuration structure of dayRange.
Expand Down
12 changes: 6 additions & 6 deletions internal/schedule/schedule_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ yaml: "bad"
}

testCases := []struct {
want *Weekly
name string
wantErrMsg string
data []byte
want *Weekly
}{{
name: "empty",
wantErrMsg: "",
Expand Down Expand Up @@ -228,9 +228,9 @@ func TestWeekly_MarshalYAML(t *testing.T) {
}

testCases := []struct {
want *Weekly
name string
data []byte
want *Weekly
}{{
name: "empty",
data: []byte(""),
Expand Down Expand Up @@ -263,8 +263,8 @@ func TestWeekly_MarshalYAML(t *testing.T) {
func TestWeekly_Validate(t *testing.T) {
testCases := []struct {
name string
in dayRange
wantErrMsg string
in dayRange
}{{
name: "empty",
wantErrMsg: "",
Expand Down Expand Up @@ -298,8 +298,8 @@ func TestWeekly_Validate(t *testing.T) {
func TestDayRange_Validate(t *testing.T) {
testCases := []struct {
name string
in dayRange
wantErrMsg string
in dayRange
}{{
name: "empty",
wantErrMsg: "",
Expand Down Expand Up @@ -413,10 +413,10 @@ func TestWeekly_UnmarshalJSON(t *testing.T) {
}

testCases := []struct {
want *Weekly
name string
wantErrMsg string
data []byte
want *Weekly
}{{
name: "empty",
wantErrMsg: "unexpected end of JSON input",
Expand Down Expand Up @@ -478,9 +478,9 @@ func TestWeekly_MarshalJSON(t *testing.T) {
}

testCases := []struct {
want *Weekly
name string
data []byte
want *Weekly
}{{
name: "empty",
data: []byte(""),
Expand Down
4 changes: 4 additions & 0 deletions scripts/make/go-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ run_linter gocognit --over='10'\
./internal/filtering/hashprefix/\
./internal/filtering/rulelist/\
./internal/filtering/safesearch/\
./internal/ipset\
./internal/next/\
./internal/rdns/\
./internal/schedule/\
Expand Down Expand Up @@ -257,9 +258,11 @@ run_linter fieldalignment \
./internal/filtering/rewrite/\
./internal/filtering/rulelist/\
./internal/filtering/safesearch/\
./internal/ipset/\
./internal/next/...\
./internal/querylog/\
./internal/rdns/\
./internal/schedule/\
./internal/stats/\
./internal/updater/\
./internal/version/\
Expand Down Expand Up @@ -287,6 +290,7 @@ run_linter gosec --quiet\
./internal/filtering/rewrite/\
./internal/filtering/rulelist/\
./internal/filtering/safesearch/\
./internal/ipset/\
./internal/next/\
./internal/rdns/\
./internal/schedule/\
Expand Down

0 comments on commit a9ee2fe

Please sign in to comment.