docstring_tokens
stringlengths
18
16.9k
code_tokens
stringlengths
75
1.81M
html_url
stringlengths
74
116
file_name
stringlengths
3
311
keep keep keep add keep keep keep keep keep
<mask> golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= <mask> golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= <mask> golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= <mask> golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= <mask> golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= <mask> golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= <mask> golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= <mask> golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= <mask> golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= </s> Pull request: all: upd go, tools, deps Updates #2275. Updates #3057. Squashed commit of the following: commit da22ad203cec1ef2a5d0a218933ddc3ac03c2ad3 Merge: dbd7e202 779fbe79 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 16:26:46 2021 +0300 Merge branch 'master' into 2275-upd-go commit dbd7e20209ddc04198e89698b7e3c2750c4d9902 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 15:04:17 2021 +0300 all: upd docker img commit 269796e3a00f60120a6327d6501f2dde031435c4 Author: Ainar Garipov <[email protected]> Date: Tue Dec 21 21:04:25 2021 +0300 all: upd go, tools, deps </s> remove golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= </s> add </s> remove golang.org/x/net v0.0.0-20210929193557-e81a3d93ecf6 h1:Z04ewVs7JhXaYkmDhBERPi41gnltfQpMWDnTnQbaCqk= </s> add golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= </s> add golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211216030914-fe4d6282115f h1:hEYJvxw1lSnWIl8X9ofsYMklzaDs90JI2az5YMd4fPM= golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= </s> add golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= </s> remove golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= </s> add </s> add golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
https://github.com/AdguardTeam/AdGuardHome/commit/2968a65f14551f7c2990df32d4c96782936be566
internal/tools/go.sum
keep keep keep keep replace keep keep keep keep keep
<mask> golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= <mask> golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E= <mask> golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= <mask> golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= </s> Pull request: all: upd go, tools, deps Updates #2275. Updates #3057. Squashed commit of the following: commit da22ad203cec1ef2a5d0a218933ddc3ac03c2ad3 Merge: dbd7e202 779fbe79 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 16:26:46 2021 +0300 Merge branch 'master' into 2275-upd-go commit dbd7e20209ddc04198e89698b7e3c2750c4d9902 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 15:04:17 2021 +0300 all: upd docker img commit 269796e3a00f60120a6327d6501f2dde031435c4 Author: Ainar Garipov <[email protected]> Date: Tue Dec 21 21:04:25 2021 +0300 all: upd go, tools, deps </s> remove golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> add golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> add golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= </s> add golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= </s> add golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= </s> add golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> remove golang.org/x/sys v0.0.0-20201112073958-5cba982894dd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2968a65f14551f7c2990df32d4c96782936be566
internal/tools/go.sum
keep add keep keep keep keep keep keep
<mask> golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= <mask> golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= <mask> golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= <mask> golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= <mask> golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= <mask> golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> Pull request: all: upd go, tools, deps Updates #2275. Updates #3057. Squashed commit of the following: commit da22ad203cec1ef2a5d0a218933ddc3ac03c2ad3 Merge: dbd7e202 779fbe79 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 16:26:46 2021 +0300 Merge branch 'master' into 2275-upd-go commit dbd7e20209ddc04198e89698b7e3c2750c4d9902 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 15:04:17 2021 +0300 all: upd docker img commit 269796e3a00f60120a6327d6501f2dde031435c4 Author: Ainar Garipov <[email protected]> Date: Tue Dec 21 21:04:25 2021 +0300 all: upd go, tools, deps </s> remove golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> add golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> add golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> add golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= </s> remove golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= </s> add </s> add golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> add golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
https://github.com/AdguardTeam/AdGuardHome/commit/2968a65f14551f7c2990df32d4c96782936be566
internal/tools/go.sum
keep keep keep keep replace replace keep keep keep keep keep
<mask> golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= <mask> golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= <mask> golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E= <mask> golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= <mask> golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= <mask> golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= <mask> golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= <mask> golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= <mask> golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= </s> Pull request: all: upd go, tools, deps Updates #2275. Updates #3057. Squashed commit of the following: commit da22ad203cec1ef2a5d0a218933ddc3ac03c2ad3 Merge: dbd7e202 779fbe79 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 16:26:46 2021 +0300 Merge branch 'master' into 2275-upd-go commit dbd7e20209ddc04198e89698b7e3c2750c4d9902 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 15:04:17 2021 +0300 all: upd docker img commit 269796e3a00f60120a6327d6501f2dde031435c4 Author: Ainar Garipov <[email protected]> Date: Tue Dec 21 21:04:25 2021 +0300 all: upd go, tools, deps </s> remove golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3 h1:3Ad41xy2WCESpufXwgs7NpDSu+vjxqLt2UFqUV+20bI= </s> add golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> remove golang.org/x/sys v0.0.0-20210228012217-479acdf4ea46/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= </s> add </s> add golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> add golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= </s> add golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= </s> add golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
https://github.com/AdguardTeam/AdGuardHome/commit/2968a65f14551f7c2990df32d4c96782936be566
internal/tools/go.sum
keep keep keep keep replace replace keep keep keep keep keep
<mask> golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= <mask> golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= <mask> golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= <mask> golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= <mask> golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= <mask> golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= <mask> golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= <mask> golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= <mask> golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= <mask> golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= <mask> golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= </s> Pull request: all: upd go, tools, deps Updates #2275. Updates #3057. Squashed commit of the following: commit da22ad203cec1ef2a5d0a218933ddc3ac03c2ad3 Merge: dbd7e202 779fbe79 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 16:26:46 2021 +0300 Merge branch 'master' into 2275-upd-go commit dbd7e20209ddc04198e89698b7e3c2750c4d9902 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 15:04:17 2021 +0300 all: upd docker img commit 269796e3a00f60120a6327d6501f2dde031435c4 Author: Ainar Garipov <[email protected]> Date: Tue Dec 21 21:04:25 2021 +0300 all: upd go, tools, deps </s> remove golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> add golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> remove golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3 h1:3Ad41xy2WCESpufXwgs7NpDSu+vjxqLt2UFqUV+20bI= </s> add golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> add golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= </s> remove require github.com/stretchr/objx v0.1.1 // indirect // TODO(e.burkov): Get rid of the fork in v0.108.0. replace github.com/insomniacslk/dhcp => github.com/AdguardTeam/dhcp v0.0.0-20210519141215-51808c73c0bf </s> add require ( github.com/BurntSushi/toml v0.4.1 // indirect github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect github.com/aead/poly1305 v0.0.0-20180717145839-3fee0db0b635 // indirect github.com/ameshkov/dnsstamps v1.0.3 // indirect github.com/beefsack/go-rate v0.0.0-20200827232406-6cde80facd47 // indirect github.com/cheekybits/genny v1.0.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/joomcode/errorx v1.0.3 // indirect github.com/josharian/native v0.0.0-20200817173448-b6b71def0850 // indirect github.com/marten-seemann/qtls-go1-16 v0.1.4 // indirect github.com/marten-seemann/qtls-go1-17 v0.1.0 // indirect github.com/mdlayher/socket v0.1.1 // indirect github.com/nxadm/tail v1.4.8 // indirect github.com/onsi/ginkgo v1.16.5 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.1.1 // indirect github.com/u-root/uio v0.0.0-20210528151154-e40b768296a7 // indirect golang.org/x/mod v0.5.1 // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/tools v0.1.8 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect honnef.co/go/tools v0.2.2 // indirect ) </s> add github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= </s> remove go 1.16 </s> add go 1.17
https://github.com/AdguardTeam/AdGuardHome/commit/2968a65f14551f7c2990df32d4c96782936be566
internal/tools/go.sum
keep replace replace keep replace replace keep keep keep
<mask> golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= <mask> golang.org/x/tools v0.0.0-20210101214203-2dba1e4ea05c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= <mask> golang.org/x/tools v0.0.0-20210104081019-d8d6ddbec6ee/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= <mask> golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= <mask> golang.org/x/tools v0.1.1 h1:wGiQel/hW0NnEkJUk8lbzkX2gFJU6PFxf1v5OlCfuOs= <mask> golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= <mask> golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= <mask> golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= <mask> golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= </s> Pull request: all: upd go, tools, deps Updates #2275. Updates #3057. Squashed commit of the following: commit da22ad203cec1ef2a5d0a218933ddc3ac03c2ad3 Merge: dbd7e202 779fbe79 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 16:26:46 2021 +0300 Merge branch 'master' into 2275-upd-go commit dbd7e20209ddc04198e89698b7e3c2750c4d9902 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 15:04:17 2021 +0300 all: upd docker img commit 269796e3a00f60120a6327d6501f2dde031435c4 Author: Ainar Garipov <[email protected]> Date: Tue Dec 21 21:04:25 2021 +0300 all: upd go, tools, deps </s> add golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.8 h1:P1HhGGuLW4aAclzjtmJdf0mJOjVUZUzOTqkAkWL+l6w= golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= </s> remove golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2 h1:BonxutuHCTL0rBDnZlKjpGIQFTjyUVTexFOdWkB6Fg0= </s> add </s> add golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= </s> remove golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect golang.org/x/tools v0.1.1 honnef.co/go/tools v0.1.4 mvdan.cc/gofumpt v0.1.1 mvdan.cc/unparam v0.0.0-20210104141923-aac4ce9116a7 </s> add golang.org/x/tools v0.1.8 honnef.co/go/tools v0.2.2 mvdan.cc/gofumpt v0.2.1 mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5 ) require ( github.com/BurntSushi/toml v0.4.1 // indirect github.com/client9/misspell v0.3.4 // indirect github.com/google/go-cmp v0.5.6 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gookit/color v1.5.0 // indirect github.com/kyoh86/nolint v0.0.1 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect golang.org/x/mod v0.5.1 // indirect golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect </s> remove github.com/kyoh86/nolint v0.0.1 // indirect github.com/securego/gosec/v2 v2.7.0 </s> add github.com/securego/gosec/v2 v2.9.5
https://github.com/AdguardTeam/AdGuardHome/commit/2968a65f14551f7c2990df32d4c96782936be566
internal/tools/go.sum
keep keep add keep keep keep keep
<mask> google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= <mask> google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= <mask> google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= <mask> gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= <mask> gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= <mask> gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= <mask> gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= </s> Pull request: all: upd go, tools, deps Updates #2275. Updates #3057. Squashed commit of the following: commit da22ad203cec1ef2a5d0a218933ddc3ac03c2ad3 Merge: dbd7e202 779fbe79 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 16:26:46 2021 +0300 Merge branch 'master' into 2275-upd-go commit dbd7e20209ddc04198e89698b7e3c2750c4d9902 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 15:04:17 2021 +0300 all: upd docker img commit 269796e3a00f60120a6327d6501f2dde031435c4 Author: Ainar Garipov <[email protected]> Date: Tue Dec 21 21:04:25 2021 +0300 all: upd go, tools, deps </s> add google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= </s> add github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= </s> add github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= </s> remove github.com/lucas-clemente/quic-go v0.21.1 h1:uuhCcu885TE9u/piPYMChI/yqA1lXfaLUEx8uCMxf8w= </s> add </s> add github.com/lucas-clemente/quic-go v0.24.0 h1:ToR7SIIEdrgOhgVTHvPgdVRJfgVy+N0wQAagH7L4d5g= github.com/lucas-clemente/quic-go v0.24.0/go.mod h1:paZuzjXCE5mj6sikVLMvqXk8lJV2AsqtJ6bDhjEfxx0= </s> remove github.com/marten-seemann/qtls-go1-15 v0.1.4 h1:RehYMOyRW8hPVEja1KBVsFVNSm35Jj9Mvs5yNoZZ28A= </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2968a65f14551f7c2990df32d4c96782936be566
internal/tools/go.sum
keep keep keep keep replace replace replace replace replace replace keep keep keep keep
<mask> honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= <mask> honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= <mask> honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= <mask> honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= <mask> honnef.co/go/tools v0.1.4 h1:SadWOkti5uVN1FAMgxn165+Mw00fuQKyk4Gyn/inxNQ= <mask> honnef.co/go/tools v0.1.4/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= <mask> mvdan.cc/gofumpt v0.1.1 h1:bi/1aS/5W00E2ny5q65w9SnKpWEF/UIOqDYBILpo9rA= <mask> mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48= <mask> mvdan.cc/unparam v0.0.0-20210104141923-aac4ce9116a7 h1:HT3e4Krq+IE44tiN36RvVEb6tvqeIdtsVSsxmNPqlFU= <mask> mvdan.cc/unparam v0.0.0-20210104141923-aac4ce9116a7/go.mod h1:hBpJkZE8H/sb+VRFvw2+rBpHNsTBcvSpk61hr8mzXZE= <mask> rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= <mask> rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= <mask> rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= <mask> sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= </s> Pull request: all: upd go, tools, deps Updates #2275. Updates #3057. Squashed commit of the following: commit da22ad203cec1ef2a5d0a218933ddc3ac03c2ad3 Merge: dbd7e202 779fbe79 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 16:26:46 2021 +0300 Merge branch 'master' into 2275-upd-go commit dbd7e20209ddc04198e89698b7e3c2750c4d9902 Author: Ainar Garipov <[email protected]> Date: Wed Dec 22 15:04:17 2021 +0300 all: upd docker img commit 269796e3a00f60120a6327d6501f2dde031435c4 Author: Ainar Garipov <[email protected]> Date: Tue Dec 21 21:04:25 2021 +0300 all: upd go, tools, deps </s> remove howett.net/plist v0.0.0-20201203080718-1454fab16a06 h1:QDxUo/w2COstK1wIBYpzQlHX/NqaQTcf9jyz347nI58= howett.net/plist v0.0.0-20201203080718-1454fab16a06/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= </s> add honnef.co/go/tools v0.2.1/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY= honnef.co/go/tools v0.2.2 h1:MNh1AVMyVX23VUHE2O27jm6lNj3vjO5DexS4A1xvnzk= honnef.co/go/tools v0.2.2/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY= howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM= howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= </s> remove golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect golang.org/x/tools v0.1.1 honnef.co/go/tools v0.1.4 mvdan.cc/gofumpt v0.1.1 mvdan.cc/unparam v0.0.0-20210104141923-aac4ce9116a7 </s> add golang.org/x/tools v0.1.8 honnef.co/go/tools v0.2.2 mvdan.cc/gofumpt v0.2.1 mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5 ) require ( github.com/BurntSushi/toml v0.4.1 // indirect github.com/client9/misspell v0.3.4 // indirect github.com/google/go-cmp v0.5.6 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gookit/color v1.5.0 // indirect github.com/kyoh86/nolint v0.0.1 // indirect github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354 // indirect github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778 // indirect golang.org/x/mod v0.5.1 // indirect golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect </s> remove github.com/kyoh86/nolint v0.0.1 // indirect github.com/securego/gosec/v2 v2.7.0 </s> add github.com/securego/gosec/v2 v2.9.5 </s> remove require github.com/stretchr/objx v0.1.1 // indirect // TODO(e.burkov): Get rid of the fork in v0.108.0. replace github.com/insomniacslk/dhcp => github.com/AdguardTeam/dhcp v0.0.0-20210519141215-51808c73c0bf </s> add require ( github.com/BurntSushi/toml v0.4.1 // indirect github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect github.com/aead/poly1305 v0.0.0-20180717145839-3fee0db0b635 // indirect github.com/ameshkov/dnsstamps v1.0.3 // indirect github.com/beefsack/go-rate v0.0.0-20200827232406-6cde80facd47 // indirect github.com/cheekybits/genny v1.0.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect github.com/google/uuid v1.3.0 // indirect github.com/joomcode/errorx v1.0.3 // indirect github.com/josharian/native v0.0.0-20200817173448-b6b71def0850 // indirect github.com/marten-seemann/qtls-go1-16 v0.1.4 // indirect github.com/marten-seemann/qtls-go1-17 v0.1.0 // indirect github.com/mdlayher/socket v0.1.1 // indirect github.com/nxadm/tail v1.4.8 // indirect github.com/onsi/ginkgo v1.16.5 // indirect github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/objx v0.1.1 // indirect github.com/u-root/uio v0.0.0-20210528151154-e40b768296a7 // indirect golang.org/x/mod v0.5.1 // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/tools v0.1.8 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect honnef.co/go/tools v0.2.2 // indirect ) </s> remove github.com/marten-seemann/qtls-go1-17 v0.1.0-beta.1.2 h1:SficYjyOthSrliKI+EaFuXS6HqSsX3dkY9AqxAAjBjw= </s> add github.com/marten-seemann/qtls-go1-16 v0.1.4 h1:xbHbOGGhrenVtII6Co8akhLEdrawwB2iHl5yhJRpnco= github.com/marten-seemann/qtls-go1-16 v0.1.4/go.mod h1:gNpI2Ol+lRS3WwSOtIUUtRwZEQMXjYK+dQSBFbethAk= </s> add github.com/marten-seemann/qtls-go1-17 v0.1.0 h1:P9ggrs5xtwiqXv/FHNwntmuLMNq3KaSIG93AtAZ48xk= github.com/marten-seemann/qtls-go1-17 v0.1.0/go.mod h1:fz4HIxByo+LlWcreM4CZOYNuz3taBQ8rN2X6FqvaWo8=
https://github.com/AdguardTeam/AdGuardHome/commit/2968a65f14551f7c2990df32d4c96782936be566
internal/tools/go.sum
keep keep add keep keep keep keep keep
<mask> export const addStaticLease = config => async (dispatch) => { <mask> dispatch(addStaticLeaseRequest()); <mask> try { <mask> await apiClient.addStaticLease(config); <mask> dispatch(addStaticLeaseSuccess(config)); <mask> dispatch(addSuccessToast(t('dhcp_lease_added', { key: name }))); <mask> dispatch(toggleLeaseModal()); <mask> } catch (error) { </s> * client: fix page scrolling on adding/deleting leases </s> remove dispatch(addStaticLeaseSuccess()); dispatch(addSuccessToast(t('dhcp_lease_added', { key: config.hostname }))); </s> add dispatch(addStaticLeaseSuccess(config)); dispatch(addSuccessToast(t('dhcp_lease_added', { key: name }))); </s> add const name = config.hostname || config.ip; </s> remove dispatch(removeStaticLeaseSuccess()); dispatch(addSuccessToast(t('dhcp_lease_deleted', { key: config.hostname }))); dispatch(getDhcpStatus()); </s> add dispatch(removeStaticLeaseSuccess(config)); dispatch(addSuccessToast(t('dhcp_lease_deleted', { key: name }))); </s> remove dispatch(getDhcpStatus()); </s> add </s> remove handleDelete = (ip, mac, hostname) => { </s> add handleDelete = (ip, mac, hostname = '') => { const name = hostname || ip; </s> remove if (window.confirm(this.props.t('delete_confirm', { key: hostname }))) { </s> add if (window.confirm(this.props.t('delete_confirm', { key: name }))) {
https://github.com/AdguardTeam/AdGuardHome/commit/2976726f99e8dffcd3b64a797907c250643cc392
client/src/actions/index.js
keep replace replace keep replace keep keep keep keep
<mask> await apiClient.addStaticLease(config); <mask> dispatch(addStaticLeaseSuccess()); <mask> dispatch(addSuccessToast(t('dhcp_lease_added', { key: config.hostname }))); <mask> dispatch(toggleLeaseModal()); <mask> dispatch(getDhcpStatus()); <mask> } catch (error) { <mask> dispatch(addErrorToast({ error })); <mask> dispatch(addStaticLeaseFailure()); <mask> } </s> * client: fix page scrolling on adding/deleting leases </s> remove dispatch(removeStaticLeaseSuccess()); dispatch(addSuccessToast(t('dhcp_lease_deleted', { key: config.hostname }))); dispatch(getDhcpStatus()); </s> add dispatch(removeStaticLeaseSuccess(config)); dispatch(addSuccessToast(t('dhcp_lease_deleted', { key: name }))); </s> add const name = config.hostname || config.ip; </s> add const name = config.hostname || config.ip; </s> remove if (window.confirm(this.props.t('delete_confirm', { key: hostname }))) { </s> add if (window.confirm(this.props.t('delete_confirm', { key: name }))) { </s> remove handleDelete = (ip, mac, hostname) => { </s> add handleDelete = (ip, mac, hostname = '') => { const name = hostname || ip;
https://github.com/AdguardTeam/AdGuardHome/commit/2976726f99e8dffcd3b64a797907c250643cc392
client/src/actions/index.js
keep keep add keep keep keep keep keep keep
<mask> export const removeStaticLease = config => async (dispatch) => { <mask> dispatch(removeStaticLeaseRequest()); <mask> try { <mask> await apiClient.removeStaticLease(config); <mask> dispatch(removeStaticLeaseSuccess(config)); <mask> dispatch(addSuccessToast(t('dhcp_lease_deleted', { key: name }))); <mask> } catch (error) { <mask> dispatch(addErrorToast({ error })); <mask> dispatch(removeStaticLeaseFailure()); </s> * client: fix page scrolling on adding/deleting leases </s> remove dispatch(removeStaticLeaseSuccess()); dispatch(addSuccessToast(t('dhcp_lease_deleted', { key: config.hostname }))); dispatch(getDhcpStatus()); </s> add dispatch(removeStaticLeaseSuccess(config)); dispatch(addSuccessToast(t('dhcp_lease_deleted', { key: name }))); </s> remove dispatch(addStaticLeaseSuccess()); dispatch(addSuccessToast(t('dhcp_lease_added', { key: config.hostname }))); </s> add dispatch(addStaticLeaseSuccess(config)); dispatch(addSuccessToast(t('dhcp_lease_added', { key: name }))); </s> add const name = config.hostname || config.ip; </s> remove dispatch(getDhcpStatus()); </s> add </s> remove handleDelete = (ip, mac, hostname) => { </s> add handleDelete = (ip, mac, hostname = '') => { const name = hostname || ip; </s> remove if (window.confirm(this.props.t('delete_confirm', { key: hostname }))) { </s> add if (window.confirm(this.props.t('delete_confirm', { key: name }))) {
https://github.com/AdguardTeam/AdGuardHome/commit/2976726f99e8dffcd3b64a797907c250643cc392
client/src/actions/index.js
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> export const removeStaticLease = config => async (dispatch) => { <mask> dispatch(removeStaticLeaseRequest()); <mask> try { <mask> await apiClient.removeStaticLease(config); <mask> dispatch(removeStaticLeaseSuccess()); <mask> dispatch(addSuccessToast(t('dhcp_lease_deleted', { key: config.hostname }))); <mask> dispatch(getDhcpStatus()); <mask> } catch (error) { <mask> dispatch(addErrorToast({ error })); <mask> dispatch(removeStaticLeaseFailure()); <mask> } <mask> }; </s> * client: fix page scrolling on adding/deleting leases </s> add const name = config.hostname || config.ip; </s> remove dispatch(addStaticLeaseSuccess()); dispatch(addSuccessToast(t('dhcp_lease_added', { key: config.hostname }))); </s> add dispatch(addStaticLeaseSuccess(config)); dispatch(addSuccessToast(t('dhcp_lease_added', { key: name }))); </s> add const name = config.hostname || config.ip; </s> remove dispatch(getDhcpStatus()); </s> add </s> remove handleDelete = (ip, mac, hostname) => { </s> add handleDelete = (ip, mac, hostname = '') => { const name = hostname || ip; </s> remove if (window.confirm(this.props.t('delete_confirm', { key: hostname }))) { </s> add if (window.confirm(this.props.t('delete_confirm', { key: name }))) {
https://github.com/AdguardTeam/AdGuardHome/commit/2976726f99e8dffcd3b64a797907c250643cc392
client/src/actions/index.js
keep keep keep keep replace keep keep keep keep keep
<mask> component={renderField} <mask> type="text" <mask> className="form-control" <mask> placeholder={t('form_enter_hostname')} <mask> validate={[required]} <mask> /> <mask> </div> <mask> </div> <mask> <mask> <div className="modal-footer"> </s> * client: fix page scrolling on adding/deleting leases </s> add staticLeases: leases, </s> remove [actions.removeStaticLeaseSuccess]: (state) => { </s> add [actions.removeStaticLeaseSuccess]: (state, { payload }) => { const leaseToRemove = payload.ip; const leases = state.staticLeases.filter(item => item.ip !== leaseToRemove); </s> add staticLeases: leases, </s> remove [actions.addStaticLeaseSuccess]: (state) => { </s> add [actions.addStaticLeaseSuccess]: (state, { payload }) => { const { ip, mac, hostname, } = payload; const newLease = { ip, mac, hostname: hostname || '', }; const leases = [...state.staticLeases, newLease]; </s> remove if (window.confirm(this.props.t('delete_confirm', { key: hostname }))) { </s> add if (window.confirm(this.props.t('delete_confirm', { key: name }))) { </s> remove handleDelete = (ip, mac, hostname) => { </s> add handleDelete = (ip, mac, hostname = '') => { const name = hostname || ip;
https://github.com/AdguardTeam/AdGuardHome/commit/2976726f99e8dffcd3b64a797907c250643cc392
client/src/components/Settings/Dhcp/StaticLeases/Form.js
keep keep keep replace keep keep keep keep keep keep keep keep replace keep keep
<mask> this.props.addStaticLease(data); <mask> } <mask> <mask> handleDelete = (ip, mac, hostname) => { <mask> // eslint-disable-next-line no-alert <mask> if (window.confirm(this.props.t('delete_confirm', { key: hostname }))) { <mask> this.props.removeStaticLease({ ip, mac, hostname }); <mask> } <mask> } <mask> <mask> handleDelete = (ip, mac, hostname) => { <mask> // eslint-disable-next-line no-alert <mask> if (window.confirm(this.props.t('delete_confirm', { key: hostname }))) { <mask> this.props.removeStaticLease({ ip, mac, hostname }); <mask> } </s> * client: fix page scrolling on adding/deleting leases </s> remove [actions.addStaticLeaseSuccess]: (state) => { </s> add [actions.addStaticLeaseSuccess]: (state, { payload }) => { const { ip, mac, hostname, } = payload; const newLease = { ip, mac, hostname: hostname || '', }; const leases = [...state.staticLeases, newLease]; </s> remove dispatch(removeStaticLeaseSuccess()); dispatch(addSuccessToast(t('dhcp_lease_deleted', { key: config.hostname }))); dispatch(getDhcpStatus()); </s> add dispatch(removeStaticLeaseSuccess(config)); dispatch(addSuccessToast(t('dhcp_lease_deleted', { key: name }))); </s> add const name = config.hostname || config.ip; </s> remove dispatch(addStaticLeaseSuccess()); dispatch(addSuccessToast(t('dhcp_lease_added', { key: config.hostname }))); </s> add dispatch(addStaticLeaseSuccess(config)); dispatch(addSuccessToast(t('dhcp_lease_added', { key: name }))); </s> add const name = config.hostname || config.ip;
https://github.com/AdguardTeam/AdGuardHome/commit/2976726f99e8dffcd3b64a797907c250643cc392
client/src/components/Settings/Dhcp/StaticLeases/index.js
keep keep keep keep replace keep keep keep keep keep
<mask> }, <mask> <mask> [actions.addStaticLeaseRequest]: state => ({ ...state, processingAdding: true }), <mask> [actions.addStaticLeaseFailure]: state => ({ ...state, processingAdding: false }), <mask> [actions.addStaticLeaseSuccess]: (state) => { <mask> const newState = { <mask> ...state, <mask> processingAdding: false, <mask> }; <mask> return newState; </s> * client: fix page scrolling on adding/deleting leases </s> remove [actions.removeStaticLeaseSuccess]: (state) => { </s> add [actions.removeStaticLeaseSuccess]: (state, { payload }) => { const leaseToRemove = payload.ip; const leases = state.staticLeases.filter(item => item.ip !== leaseToRemove); </s> add staticLeases: leases, </s> add staticLeases: leases, </s> add const name = config.hostname || config.ip; </s> remove handleDelete = (ip, mac, hostname) => { </s> add handleDelete = (ip, mac, hostname = '') => { const name = hostname || ip; </s> add const name = config.hostname || config.ip;
https://github.com/AdguardTeam/AdGuardHome/commit/2976726f99e8dffcd3b64a797907c250643cc392
client/src/reducers/index.js
keep keep keep add keep keep keep keep
<mask> }; <mask> const leases = [...state.staticLeases, newLease]; <mask> const newState = { <mask> ...state, <mask> processingAdding: false, <mask> }; <mask> return newState; <mask> }, </s> * client: fix page scrolling on adding/deleting leases </s> remove [actions.addStaticLeaseSuccess]: (state) => { </s> add [actions.addStaticLeaseSuccess]: (state, { payload }) => { const { ip, mac, hostname, } = payload; const newLease = { ip, mac, hostname: hostname || '', }; const leases = [...state.staticLeases, newLease]; </s> add staticLeases: leases, </s> remove [actions.removeStaticLeaseSuccess]: (state) => { </s> add [actions.removeStaticLeaseSuccess]: (state, { payload }) => { const leaseToRemove = payload.ip; const leases = state.staticLeases.filter(item => item.ip !== leaseToRemove); </s> add const name = config.hostname || config.ip; </s> add const name = config.hostname || config.ip; </s> remove handleDelete = (ip, mac, hostname) => { </s> add handleDelete = (ip, mac, hostname = '') => { const name = hostname || ip;
https://github.com/AdguardTeam/AdGuardHome/commit/2976726f99e8dffcd3b64a797907c250643cc392
client/src/reducers/index.js
keep keep keep keep replace keep keep keep keep keep
<mask> }, <mask> <mask> [actions.removeStaticLeaseRequest]: state => ({ ...state, processingDeleting: true }), <mask> [actions.removeStaticLeaseFailure]: state => ({ ...state, processingDeleting: false }), <mask> [actions.removeStaticLeaseSuccess]: (state) => { <mask> const newState = { <mask> ...state, <mask> processingDeleting: false, <mask> }; <mask> return newState; </s> * client: fix page scrolling on adding/deleting leases </s> remove [actions.addStaticLeaseSuccess]: (state) => { </s> add [actions.addStaticLeaseSuccess]: (state, { payload }) => { const { ip, mac, hostname, } = payload; const newLease = { ip, mac, hostname: hostname || '', }; const leases = [...state.staticLeases, newLease]; </s> add staticLeases: leases, </s> add staticLeases: leases, </s> add const name = config.hostname || config.ip; </s> remove handleDelete = (ip, mac, hostname) => { </s> add handleDelete = (ip, mac, hostname = '') => { const name = hostname || ip; </s> add const name = config.hostname || config.ip;
https://github.com/AdguardTeam/AdGuardHome/commit/2976726f99e8dffcd3b64a797907c250643cc392
client/src/reducers/index.js
keep keep add keep keep keep keep keep
<mask> const leases = state.staticLeases.filter(item => item.ip !== leaseToRemove); <mask> const newState = { <mask> ...state, <mask> processingDeleting: false, <mask> }; <mask> return newState; <mask> }, <mask> }, { </s> * client: fix page scrolling on adding/deleting leases </s> remove [actions.removeStaticLeaseSuccess]: (state) => { </s> add [actions.removeStaticLeaseSuccess]: (state, { payload }) => { const leaseToRemove = payload.ip; const leases = state.staticLeases.filter(item => item.ip !== leaseToRemove); </s> add staticLeases: leases, </s> remove [actions.addStaticLeaseSuccess]: (state) => { </s> add [actions.addStaticLeaseSuccess]: (state, { payload }) => { const { ip, mac, hostname, } = payload; const newLease = { ip, mac, hostname: hostname || '', }; const leases = [...state.staticLeases, newLease]; </s> add const name = config.hostname || config.ip; </s> add const name = config.hostname || config.ip; </s> remove handleDelete = (ip, mac, hostname) => { </s> add handleDelete = (ip, mac, hostname = '') => { const name = hostname || ip;
https://github.com/AdguardTeam/AdGuardHome/commit/2976726f99e8dffcd3b64a797907c250643cc392
client/src/reducers/index.js
keep keep keep keep replace keep keep keep keep keep
<mask> // for ReasonRewrite: <mask> CanonName string `json:",omitempty"` // CNAME value <mask> <mask> // for RewriteEtcHosts: <mask> ReverseHost string `json:",omitempty"` <mask> <mask> // for ReasonRewrite & RewriteEtcHosts: <mask> IPList []net.IP `json:",omitempty"` // list of IP addresses <mask> <mask> // for FilteredBlockedService: </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove lock sync.Mutex // serialize access to table table map[string][]net.IP // 'hostname -> IP' table tableReverse map[string]string // "IP -> hostname" table for reverse lookup </s> add // lock protects table and tableReverse. lock sync.Mutex // table is the host-to-IPs map. table map[string][]net.IP // tableReverse is the IP-to-hosts map. // // TODO(a.garipov): Make better use of newtypes. Perhaps a custom map. tableReverse map[string][]string </s> remove return "" </s> add return nil </s> remove // Fill clients array from system hosts-file </s> add // addFromHostsFile fills the clients hosts list from the system's hosts files. </s> remove // ProcessReverse - process PTR request // Return "" if not found or an error occurred func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) string { </s> add // ProcessReverse processes a PTR request. It returns nil if nothing is found. func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) (hosts []string) { </s> remove // List - get "IP -> hostname" table. Thread-safe. func (a *AutoHosts) List() map[string]string { table := make(map[string]string) </s> add // List returns an IP-to-hostnames table. It is safe for concurrent use. func (a *AutoHosts) List() (ipToHosts map[string][]string) { </s> remove return "" // invalid IP in question </s> add return nil
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/dnsfilter/dnsfilter.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> <mask> // Now check the hosts file -- do we have any rules for it? <mask> // just like DNS rewrites, it has higher priority than filtering rules. <mask> if d.Config.AutoHosts != nil { <mask> ips := d.Config.AutoHosts.Process(host, qtype) <mask> if ips != nil { <mask> result.Reason = RewriteEtcHosts <mask> result.IPList = ips <mask> return result, nil <mask> } <mask> <mask> revHost := d.Config.AutoHosts.ProcessReverse(host, qtype) <mask> if len(revHost) != 0 { <mask> result.Reason = RewriteEtcHosts <mask> result.ReverseHost = revHost + "." <mask> return result, nil <mask> } <mask> } <mask> <mask> // Then check the filter lists. <mask> // if request is blocked -- it should be blocked. </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove return "" </s> add return nil </s> remove if len(host) == 0 { return "" // not found </s> add hosts = a.tableReverse[ipStr] if len(hosts) == 0 { return nil // not found </s> remove for ip, name := range hosts { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ </s> add for ip, names := range hosts { for _, name := range names { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ } </s> remove // ProcessReverse - process PTR request // Return "" if not found or an error occurred func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) string { </s> add // ProcessReverse processes a PTR request. It returns nil if nothing is found. func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) (hosts []string) { </s> remove return "" // invalid IP in question </s> add return nil </s> remove func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string]string, fn string) { </s> add func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string][]string, fn string) {
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/dnsfilter/dnsfilter.go
keep add keep keep keep keep keep keep
<mask> // resolve canonical name, not the original host name <mask> d.Req.Question[0].Name = dns.Fqdn(res.CanonName) <mask> <mask> ptr := &dns.PTR{ <mask> Hdr: hdr, <mask> Ptr: h, <mask> } <mask> </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove } else if res.Reason == dnsfilter.RewriteEtcHosts && len(res.ReverseHost) != 0 { </s> add ptr := &dns.PTR{ Hdr: hdr, Ptr: h, } </s> remove resp := s.makeResponse(req) ptr := &dns.PTR{} ptr.Hdr = dns.RR_Header{ Name: req.Question[0].Name, Rrtype: dns.TypePTR, Ttl: s.conf.BlockedResponseTTL, Class: dns.ClassINET, </s> add resp.Answer = append(resp.Answer, ptr) </s> remove for ip, name := range hosts { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ </s> add for ip, names := range hosts { for _, name := range names { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ } </s> remove ptr.Ptr = res.ReverseHost resp.Answer = append(resp.Answer, ptr) </s> add </s> remove if len(host) == 0 { return "" // not found </s> add hosts = a.tableReverse[ipStr] if len(hosts) == 0 { return nil // not found </s> remove ips := d.Config.AutoHosts.Process(host, qtype) if ips != nil { result.Reason = RewriteEtcHosts result.IPList = ips return result, nil } revHost := d.Config.AutoHosts.ProcessReverse(host, qtype) if len(revHost) != 0 { result.Reason = RewriteEtcHosts result.ReverseHost = revHost + "." return result, nil </s> add matched, err := d.checkAutoHosts(host, qtype, &result) if matched { return result, err
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/dnsforward/filter.go
keep keep keep replace keep replace replace replace replace replace replace replace keep keep
<mask> // resolve canonical name, not the original host name <mask> d.Req.Question[0].Name = dns.Fqdn(res.CanonName) <mask> <mask> } else if res.Reason == dnsfilter.RewriteEtcHosts && len(res.ReverseHost) != 0 { <mask> <mask> resp := s.makeResponse(req) <mask> ptr := &dns.PTR{} <mask> ptr.Hdr = dns.RR_Header{ <mask> Name: req.Question[0].Name, <mask> Rrtype: dns.TypePTR, <mask> Ttl: s.conf.BlockedResponseTTL, <mask> Class: dns.ClassINET, <mask> } <mask> ptr.Ptr = res.ReverseHost </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> add } else if res.Reason == dnsfilter.RewriteEtcHosts && len(res.ReverseHosts) != 0 { resp := s.makeResponse(req) for _, h := range res.ReverseHosts { hdr := dns.RR_Header{ Name: req.Question[0].Name, Rrtype: dns.TypePTR, Ttl: s.conf.BlockedResponseTTL, Class: dns.ClassINET, } </s> remove ptr.Ptr = res.ReverseHost resp.Answer = append(resp.Answer, ptr) </s> add </s> remove for ip, name := range hosts { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ </s> add for ip, names := range hosts { for _, name := range names { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ } </s> remove ips := d.Config.AutoHosts.Process(host, qtype) if ips != nil { result.Reason = RewriteEtcHosts result.IPList = ips return result, nil } revHost := d.Config.AutoHosts.ProcessReverse(host, qtype) if len(revHost) != 0 { result.Reason = RewriteEtcHosts result.ReverseHost = revHost + "." return result, nil </s> add matched, err := d.checkAutoHosts(host, qtype, &result) if matched { return result, err </s> remove if len(host) == 0 { return "" // not found </s> add hosts = a.tableReverse[ipStr] if len(hosts) == 0 { return nil // not found
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/dnsforward/filter.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> Rrtype: dns.TypePTR, <mask> Ttl: s.conf.BlockedResponseTTL, <mask> Class: dns.ClassINET, <mask> } <mask> ptr.Ptr = res.ReverseHost <mask> resp.Answer = append(resp.Answer, ptr) <mask> d.Res = resp <mask> } else if res.Reason == dnsfilter.ReasonRewrite || res.Reason == dnsfilter.RewriteEtcHosts { <mask> resp := s.makeResponse(req) <mask> <mask> name := host </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove resp := s.makeResponse(req) ptr := &dns.PTR{} ptr.Hdr = dns.RR_Header{ Name: req.Question[0].Name, Rrtype: dns.TypePTR, Ttl: s.conf.BlockedResponseTTL, Class: dns.ClassINET, </s> add resp.Answer = append(resp.Answer, ptr) </s> add } else if res.Reason == dnsfilter.RewriteEtcHosts && len(res.ReverseHosts) != 0 { resp := s.makeResponse(req) for _, h := range res.ReverseHosts { hdr := dns.RR_Header{ Name: req.Question[0].Name, Rrtype: dns.TypePTR, Ttl: s.conf.BlockedResponseTTL, Class: dns.ClassINET, } </s> remove } else if res.Reason == dnsfilter.RewriteEtcHosts && len(res.ReverseHost) != 0 { </s> add ptr := &dns.PTR{ Hdr: hdr, Ptr: h, } </s> remove for ip, name := range hosts { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ </s> add for ip, names := range hosts { for _, name := range names { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ } </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "localhost") </s> add hosts = ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 1) { assert.Equal(t, hosts[0], "localhost") } </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "host") </s> add hosts := ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 2) { assert.Equal(t, hosts[0], "host") }
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/dnsforward/filter.go
keep keep keep keep replace keep keep keep keep keep
<mask> log.Debug("Clients: removed %d client aliases", n) <mask> return n <mask> } <mask> <mask> // Fill clients array from system hosts-file <mask> func (clients *clientsContainer) addFromHostsFile() { <mask> hosts := clients.autoHosts.List() <mask> <mask> clients.lock.Lock() <mask> defer clients.lock.Unlock() </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove for ip, name := range hosts { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ </s> add for ip, names := range hosts { for _, name := range names { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ } </s> remove host := a.tableReverse[ipStr] a.lock.Unlock() </s> add defer a.lock.Unlock() </s> remove tableRev := make(map[string]string) </s> add tableRev := make(map[string][]string) </s> remove tableRev[ipStr] = host log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, host) </s> add tableRev[ipStr] = []string{newHost} log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, newHost) return } for _, host := range hosts { if host == newHost { return } </s> add defer a.lock.Unlock() ipToHosts = make(map[string][]string, len(a.tableReverse)) </s> remove func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string]string, fn string) { </s> add func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string][]string, fn string) {
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/home/clients.go
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
<mask> defer clients.lock.Unlock() <mask> _ = clients.rmHosts(ClientSourceHostsFile) <mask> <mask> n := 0 <mask> for ip, name := range hosts { <mask> ok, err := clients.addHost(ip, name, ClientSourceHostsFile) <mask> if err != nil { <mask> log.Debug("Clients: %s", err) <mask> } <mask> if ok { <mask> n++ <mask> } <mask> } <mask> <mask> log.Debug("Clients: added %d client aliases from system hosts-file", n) <mask> } </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove // Fill clients array from system hosts-file </s> add // addFromHostsFile fills the clients hosts list from the system's hosts files. </s> remove func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string]string, fn string) { </s> add func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string][]string, fn string) { </s> remove ips := d.Config.AutoHosts.Process(host, qtype) if ips != nil { result.Reason = RewriteEtcHosts result.IPList = ips return result, nil } revHost := d.Config.AutoHosts.ProcessReverse(host, qtype) if len(revHost) != 0 { result.Reason = RewriteEtcHosts result.ReverseHost = revHost + "." return result, nil </s> add matched, err := d.checkAutoHosts(host, qtype, &result) if matched { return result, err </s> remove tableRev[ipStr] = host log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, host) </s> add tableRev[ipStr] = []string{newHost} log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, newHost) return } for _, host := range hosts { if host == newHost { return } </s> add } else if res.Reason == dnsfilter.RewriteEtcHosts && len(res.ReverseHosts) != 0 { resp := s.makeResponse(req) for _, h := range res.ReverseHosts { hdr := dns.RR_Header{ Name: req.Question[0].Name, Rrtype: dns.TypePTR, Ttl: s.conf.BlockedResponseTTL, Class: dns.ClassINET, } </s> add tableRev[ipStr] = append(tableRev[ipStr], newHost) log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, newHost)
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/home/clients.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> type onChangedT func() <mask> <mask> // AutoHosts - automatic DNS records <mask> type AutoHosts struct { <mask> lock sync.Mutex // serialize access to table <mask> table map[string][]net.IP // 'hostname -> IP' table <mask> tableReverse map[string]string // "IP -> hostname" table for reverse lookup <mask> <mask> hostsFn string // path to the main hosts-file <mask> hostsDirs []string // paths to OS-specific directories with hosts-files <mask> watcher *fsnotify.Watcher // file and directory watcher object <mask> updateChan chan bool // signal for 'updateLoop' goroutine </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, host) return host </s> add log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, hosts) return hosts </s> remove // List - get "IP -> hostname" table. Thread-safe. func (a *AutoHosts) List() map[string]string { table := make(map[string]string) </s> add // List returns an IP-to-hostnames table. It is safe for concurrent use. func (a *AutoHosts) List() (ipToHosts map[string][]string) { </s> remove ReverseHost string `json:",omitempty"` </s> add ReverseHosts []string `json:",omitempty"` </s> remove // update "reverse" table func (a *AutoHosts) updateTableRev(tableRev map[string]string, host string, ipAddr net.IP) { </s> add // updateTableRev updates the reverse address table. func (a *AutoHosts) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) { </s> remove // Fill clients array from system hosts-file </s> add // addFromHostsFile fills the clients hosts list from the system's hosts files. </s> remove ips := d.Config.AutoHosts.Process(host, qtype) if ips != nil { result.Reason = RewriteEtcHosts result.IPList = ips return result, nil } revHost := d.Config.AutoHosts.ProcessReverse(host, qtype) if len(revHost) != 0 { result.Reason = RewriteEtcHosts result.ReverseHost = revHost + "." return result, nil </s> add matched, err := d.checkAutoHosts(host, qtype, &result) if matched { return result, err
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts.go
keep keep keep keep replace replace replace keep replace keep
<mask> log.Debug("AutoHosts: answer: %s -> %v", host, ipsCopy) <mask> return ipsCopy <mask> } <mask> <mask> // ProcessReverse - process PTR request <mask> // Return "" if not found or an error occurred <mask> func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) string { <mask> if qtype != dns.TypePTR { <mask> return "" <mask> } </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, host) return host </s> add log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, hosts) return hosts </s> remove if len(host) == 0 { return "" // not found </s> add hosts = a.tableReverse[ipStr] if len(hosts) == 0 { return nil // not found </s> remove host := a.tableReverse[ipStr] a.lock.Unlock() </s> add defer a.lock.Unlock() </s> remove tableRev[ipStr] = host log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, host) </s> add tableRev[ipStr] = []string{newHost} log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, newHost) return } for _, host := range hosts { if host == newHost { return } </s> remove // List - get "IP -> hostname" table. Thread-safe. func (a *AutoHosts) List() map[string]string { table := make(map[string]string) </s> add // List returns an IP-to-hostnames table. It is safe for concurrent use. func (a *AutoHosts) List() (ipToHosts map[string][]string) {
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts.go
keep keep keep replace keep keep keep keep replace replace keep keep keep keep
<mask> <mask> ipReal := DNSUnreverseAddr(addr) <mask> if ipReal == nil { <mask> return "" // invalid IP in question <mask> } <mask> ipStr := ipReal.String() <mask> <mask> a.lock.Lock() <mask> host := a.tableReverse[ipStr] <mask> a.lock.Unlock() <mask> <mask> if len(host) == 0 { <mask> return "" // not found <mask> } </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove return "" </s> add return nil </s> remove if len(host) == 0 { return "" // not found </s> add hosts = a.tableReverse[ipStr] if len(hosts) == 0 { return nil // not found </s> remove // ProcessReverse - process PTR request // Return "" if not found or an error occurred func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) string { </s> add // ProcessReverse processes a PTR request. It returns nil if nothing is found. func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) (hosts []string) { </s> remove log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, host) return host </s> add log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, hosts) return hosts </s> remove ips := d.Config.AutoHosts.Process(host, qtype) if ips != nil { result.Reason = RewriteEtcHosts result.IPList = ips return result, nil } revHost := d.Config.AutoHosts.ProcessReverse(host, qtype) if len(revHost) != 0 { result.Reason = RewriteEtcHosts result.ReverseHost = revHost + "." return result, nil </s> add matched, err := d.checkAutoHosts(host, qtype, &result) if matched { return result, err
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts.go
keep keep keep keep replace replace keep keep replace replace keep keep keep
<mask> a.lock.Lock() <mask> host := a.tableReverse[ipStr] <mask> a.lock.Unlock() <mask> <mask> if len(host) == 0 { <mask> return "" // not found <mask> } <mask> <mask> log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, host) <mask> return host <mask> } <mask> <mask> // List - get "IP -> hostname" table. Thread-safe. </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove // List - get "IP -> hostname" table. Thread-safe. func (a *AutoHosts) List() map[string]string { table := make(map[string]string) </s> add // List returns an IP-to-hostnames table. It is safe for concurrent use. func (a *AutoHosts) List() (ipToHosts map[string][]string) { </s> remove host := a.tableReverse[ipStr] a.lock.Unlock() </s> add defer a.lock.Unlock() </s> remove // update "reverse" table func (a *AutoHosts) updateTableRev(tableRev map[string]string, host string, ipAddr net.IP) { </s> add // updateTableRev updates the reverse address table. func (a *AutoHosts) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) { </s> remove // ProcessReverse - process PTR request // Return "" if not found or an error occurred func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) string { </s> add // ProcessReverse processes a PTR request. It returns nil if nothing is found. func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) (hosts []string) { </s> remove tableRev[ipStr] = host log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, host) </s> add tableRev[ipStr] = []string{newHost} log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, newHost) return } for _, host := range hosts { if host == newHost { return }
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts.go
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, host) <mask> return host <mask> } <mask> <mask> // List - get "IP -> hostname" table. Thread-safe. <mask> func (a *AutoHosts) List() map[string]string { <mask> table := make(map[string]string) <mask> a.lock.Lock() <mask> for k, v := range a.tableReverse { <mask> table[k] = v <mask> } <mask> a.lock.Unlock() </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, host) return host </s> add log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, hosts) return hosts </s> remove table[k] = v </s> add ipToHosts[k] = v </s> add defer a.lock.Unlock() ipToHosts = make(map[string][]string, len(a.tableReverse)) </s> remove a.lock.Unlock() return table </s> add return ipToHosts </s> remove if len(host) == 0 { return "" // not found </s> add hosts = a.tableReverse[ipStr] if len(hosts) == 0 { return nil // not found </s> remove // update "reverse" table func (a *AutoHosts) updateTableRev(tableRev map[string]string, host string, ipAddr net.IP) { </s> add // updateTableRev updates the reverse address table. func (a *AutoHosts) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) {
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts.go
keep keep keep add keep keep keep keep keep keep
<mask> <mask> // List returns an IP-to-hostnames table. It is safe for concurrent use. <mask> func (a *AutoHosts) List() (ipToHosts map[string][]string) { <mask> a.lock.Lock() <mask> for k, v := range a.tableReverse { <mask> ipToHosts[k] = v <mask> } <mask> <mask> return ipToHosts <mask> } </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove // List - get "IP -> hostname" table. Thread-safe. func (a *AutoHosts) List() map[string]string { table := make(map[string]string) </s> add // List returns an IP-to-hostnames table. It is safe for concurrent use. func (a *AutoHosts) List() (ipToHosts map[string][]string) { </s> remove table[k] = v </s> add ipToHosts[k] = v </s> remove a.lock.Unlock() return table </s> add return ipToHosts </s> remove log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, host) return host </s> add log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, hosts) return hosts </s> remove // ProcessReverse - process PTR request // Return "" if not found or an error occurred func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) string { </s> add // ProcessReverse processes a PTR request. It returns nil if nothing is found. func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) (hosts []string) { </s> remove tableRev[ipStr] = host log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, host) </s> add tableRev[ipStr] = []string{newHost} log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, newHost) return } for _, host := range hosts { if host == newHost { return }
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts.go
keep keep keep keep replace keep replace replace keep keep keep keep
<mask> func (a *AutoHosts) List() map[string]string { <mask> table := make(map[string]string) <mask> a.lock.Lock() <mask> for k, v := range a.tableReverse { <mask> table[k] = v <mask> } <mask> a.lock.Unlock() <mask> return table <mask> } <mask> <mask> // update table <mask> func (a *AutoHosts) updateTable(table map[string][]net.IP, host string, ipAddr net.IP) { </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove // List - get "IP -> hostname" table. Thread-safe. func (a *AutoHosts) List() map[string]string { table := make(map[string]string) </s> add // List returns an IP-to-hostnames table. It is safe for concurrent use. func (a *AutoHosts) List() (ipToHosts map[string][]string) { </s> add defer a.lock.Unlock() ipToHosts = make(map[string][]string, len(a.tableReverse)) </s> remove // update "reverse" table func (a *AutoHosts) updateTableRev(tableRev map[string]string, host string, ipAddr net.IP) { </s> add // updateTableRev updates the reverse address table. func (a *AutoHosts) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) { </s> remove _, ok := tableRev[ipStr] </s> add hosts, ok := tableRev[ipStr] </s> remove log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, host) return host </s> add log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, hosts) return hosts
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts.go
keep keep keep replace replace keep replace keep keep keep keep
<mask> } <mask> } <mask> <mask> // update "reverse" table <mask> func (a *AutoHosts) updateTableRev(tableRev map[string]string, host string, ipAddr net.IP) { <mask> ipStr := ipAddr.String() <mask> _, ok := tableRev[ipStr] <mask> if !ok { <mask> tableRev[ipStr] = host <mask> log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, host) <mask> } </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove tableRev[ipStr] = host log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, host) </s> add tableRev[ipStr] = []string{newHost} log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, newHost) return } for _, host := range hosts { if host == newHost { return } </s> add tableRev[ipStr] = append(tableRev[ipStr], newHost) log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, newHost) </s> remove a.lock.Unlock() return table </s> add return ipToHosts </s> remove log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, host) return host </s> add log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, hosts) return hosts </s> remove if len(host) == 0 { return "" // not found </s> add hosts = a.tableReverse[ipStr] if len(hosts) == 0 { return nil // not found
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> func (a *AutoHosts) updateTableRev(tableRev map[string]string, host string, ipAddr net.IP) { <mask> ipStr := ipAddr.String() <mask> _, ok := tableRev[ipStr] <mask> if !ok { <mask> tableRev[ipStr] = host <mask> log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, host) <mask> } <mask> } <mask> <mask> // Read IP-hostname pairs from file <mask> // Multiple hostnames per line (per one IP) is supported. </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> add tableRev[ipStr] = append(tableRev[ipStr], newHost) log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, newHost) </s> remove _, ok := tableRev[ipStr] </s> add hosts, ok := tableRev[ipStr] </s> remove // update "reverse" table func (a *AutoHosts) updateTableRev(tableRev map[string]string, host string, ipAddr net.IP) { </s> add // updateTableRev updates the reverse address table. func (a *AutoHosts) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) { </s> remove func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string]string, fn string) { </s> add func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string][]string, fn string) { </s> remove a.lock.Unlock() return table </s> add return ipToHosts </s> remove log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, host) return host </s> add log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, hosts) return hosts
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts.go
keep keep keep add keep keep keep keep keep keep
<mask> if host == newHost { <mask> return <mask> } <mask> } <mask> } <mask> <mask> // Read IP-hostname pairs from file <mask> // Multiple hostnames per line (per one IP) is supported. <mask> func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string][]string, fn string) { <mask> f, err := os.Open(fn) </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string]string, fn string) { </s> add func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string][]string, fn string) { </s> remove tableRev[ipStr] = host log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, host) </s> add tableRev[ipStr] = []string{newHost} log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, newHost) return } for _, host := range hosts { if host == newHost { return } </s> remove // update "reverse" table func (a *AutoHosts) updateTableRev(tableRev map[string]string, host string, ipAddr net.IP) { </s> add // updateTableRev updates the reverse address table. func (a *AutoHosts) updateTableRev(tableRev map[string][]string, newHost string, ipAddr net.IP) { </s> remove a.lock.Unlock() return table </s> add return ipToHosts </s> remove ips := d.Config.AutoHosts.Process(host, qtype) if ips != nil { result.Reason = RewriteEtcHosts result.IPList = ips return result, nil } revHost := d.Config.AutoHosts.ProcessReverse(host, qtype) if len(revHost) != 0 { result.Reason = RewriteEtcHosts result.ReverseHost = revHost + "." return result, nil </s> add matched, err := d.checkAutoHosts(host, qtype, &result) if matched { return result, err </s> remove for ip, name := range hosts { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ </s> add for ip, names := range hosts { for _, name := range names { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ }
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> // Read IP-hostname pairs from file <mask> // Multiple hostnames per line (per one IP) is supported. <mask> func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string]string, fn string) { <mask> f, err := os.Open(fn) <mask> if err != nil { <mask> log.Error("AutoHosts: %s", err) <mask> return <mask> } </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> add tableRev[ipStr] = append(tableRev[ipStr], newHost) log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, newHost) </s> remove tableRev[ipStr] = host log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, host) </s> add tableRev[ipStr] = []string{newHost} log.Debug("AutoHosts: added reverse-address %s -> %s", ipStr, newHost) return } for _, host := range hosts { if host == newHost { return } </s> remove for ip, name := range hosts { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ </s> add for ip, names := range hosts { for _, name := range names { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ } </s> remove ips := d.Config.AutoHosts.Process(host, qtype) if ips != nil { result.Reason = RewriteEtcHosts result.IPList = ips return result, nil } revHost := d.Config.AutoHosts.ProcessReverse(host, qtype) if len(revHost) != 0 { result.Reason = RewriteEtcHosts result.ReverseHost = revHost + "." return result, nil </s> add matched, err := d.checkAutoHosts(host, qtype, &result) if matched { return result, err </s> remove tableRev := make(map[string]string) </s> add tableRev := make(map[string][]string) </s> remove return "" </s> add return nil
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> // updateHosts - loads system hosts <mask> func (a *AutoHosts) updateHosts() { <mask> table := make(map[string][]net.IP) <mask> tableRev := make(map[string]string) <mask> <mask> a.load(table, tableRev, a.hostsFn) <mask> <mask> for _, dir := range a.hostsDirs { <mask> fis, err := ioutil.ReadDir(dir) </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove for ip, name := range hosts { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ </s> add for ip, names := range hosts { for _, name := range names { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ } </s> remove table[k] = v </s> add ipToHosts[k] = v </s> remove // List - get "IP -> hostname" table. Thread-safe. func (a *AutoHosts) List() map[string]string { table := make(map[string]string) </s> add // List returns an IP-to-hostnames table. It is safe for concurrent use. func (a *AutoHosts) List() (ipToHosts map[string][]string) { </s> remove func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string]string, fn string) { </s> add func (a *AutoHosts) load(table map[string][]net.IP, tableRev map[string][]string, fn string) { </s> remove log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, host) return host </s> add log.Debug("AutoHosts: reverse-lookup: %s -> %s", addr, hosts) return hosts </s> remove a.lock.Unlock() return table </s> add return ipToHosts
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> func prepareTestDir() string { <mask> const dir = "./agh-test" <mask> _ = os.RemoveAll(dir) <mask> _ = os.MkdirAll(dir, 0755) <mask> return dir <mask> } <mask> <mask> func TestAutoHostsResolution(t *testing.T) { <mask> ah := AutoHosts{} </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "localhost") </s> add hosts = ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 1) { assert.Equal(t, hosts[0], "localhost") } </s> remove tableRev := make(map[string]string) </s> add tableRev := make(map[string][]string) </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "host") </s> add hosts := ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 2) { assert.Equal(t, hosts[0], "host") } </s> remove table[k] = v </s> add ipToHosts[k] = v </s> remove a.lock.Unlock() return table </s> add return ipToHosts </s> add defer a.lock.Unlock() ipToHosts = make(map[string][]string, len(a.tableReverse))
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts_test.go
keep keep keep replace keep replace
<mask> <mask> // Test hosts file <mask> table := ah.List() <mask> name, ok := table["127.0.0.1"] <mask> assert.True(t, ok) <mask> assert.Equal(t, "host", name) </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "host") </s> add hosts := ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 2) { assert.Equal(t, hosts[0], "host") } </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "localhost") </s> add hosts = ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 1) { assert.Equal(t, hosts[0], "localhost") } </s> remove for ip, name := range hosts { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ </s> add for ip, names := range hosts { for _, name := range names { ok, err := clients.addHost(ip, name, ClientSourceHostsFile) if err != nil { log.Debug("Clients: %s", err) } if ok { n++ } </s> remove _, ok := tableRev[ipStr] </s> add hosts, ok := tableRev[ipStr] </s> remove a.lock.Unlock() return table </s> add return ipToHosts
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> // Test PTR <mask> a, _ := dns.ReverseAddr("127.0.0.1") <mask> a = strings.TrimSuffix(a, ".") <mask> assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "host") <mask> a, _ = dns.ReverseAddr("::1") <mask> a = strings.TrimSuffix(a, ".") <mask> assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "localhost") <mask> } <mask> </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "localhost") </s> add hosts = ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 1) { assert.Equal(t, hosts[0], "localhost") } </s> remove assert.Equal(t, "host", name) </s> add assert.Equal(t, []string{"host", "localhost"}, names) </s> remove name, ok := table["127.0.0.1"] </s> add names, ok := table["127.0.0.1"] </s> remove _ = os.MkdirAll(dir, 0755) </s> add _ = os.MkdirAll(dir, 0o755) </s> remove // ProcessReverse - process PTR request // Return "" if not found or an error occurred func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) string { </s> add // ProcessReverse processes a PTR request. It returns nil if nothing is found. func (a *AutoHosts) ProcessReverse(addr string, qtype uint16) (hosts []string) { </s> remove } else if res.Reason == dnsfilter.RewriteEtcHosts && len(res.ReverseHost) != 0 { </s> add ptr := &dns.PTR{ Hdr: hdr, Ptr: h, }
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> a = strings.TrimSuffix(a, ".") <mask> assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "host") <mask> a, _ = dns.ReverseAddr("::1") <mask> a = strings.TrimSuffix(a, ".") <mask> assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "localhost") <mask> } <mask> <mask> func TestAutoHostsFSNotify(t *testing.T) { <mask> ah := AutoHosts{} <mask> </s> Pull request: * all: allow multiple hosts in reverse lookups Merge in DNS/adguard-home from 2269-multiple-hosts to master For #2269. Squashed commit of the following: commit f8ae452540b106f2d5b130b8edb08c4e76b003f4 Merge: 8dd06f7cc 3e1f92225 Author: Ainar Garipov <[email protected]> Date: Fri Nov 6 17:28:12 2020 +0300 Merge branch 'master' into 2269-multiple-hosts commit 8dd06f7cca27ec32a4690e2673603b166f82af0a Author: Ainar Garipov <[email protected]> Date: Thu Nov 5 20:28:33 2020 +0300 * all: allow multiple hosts in reverse lookups </s> remove assert.True(t, ah.ProcessReverse(a, dns.TypePTR) == "host") </s> add hosts := ah.ProcessReverse(a, dns.TypePTR) if assert.Len(t, hosts, 2) { assert.Equal(t, hosts[0], "host") } </s> remove assert.Equal(t, "host", name) </s> add assert.Equal(t, []string{"host", "localhost"}, names) </s> remove _ = os.MkdirAll(dir, 0755) </s> add _ = os.MkdirAll(dir, 0o755) </s> remove name, ok := table["127.0.0.1"] </s> add names, ok := table["127.0.0.1"] </s> remove table[k] = v </s> add ipToHosts[k] = v </s> remove resp := s.makeResponse(req) ptr := &dns.PTR{} ptr.Hdr = dns.RR_Header{ Name: req.Question[0].Name, Rrtype: dns.TypePTR, Ttl: s.conf.BlockedResponseTTL, Class: dns.ClassINET, </s> add resp.Answer = append(resp.Answer, ptr)
https://github.com/AdguardTeam/AdGuardHome/commit/298f74ba814770306501bc1a594f18d5ba59d1ff
internal/util/auto_hosts_test.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> return nil <mask> }, <mask> } <mask> <mask> var resultHandlers = map[string]logEntryHandler{ <mask> "IsFiltered": func(t json.Token, ent *logEntry) error { <mask> v, ok := t.(bool) <mask> if !ok { <mask> return nil <mask> } <mask> ent.Result.IsFiltered = v <mask> return nil <mask> }, <mask> "Rule": func(t json.Token, ent *logEntry) error { <mask> s, ok := t.(string) <mask> if !ok { <mask> return nil <mask> } <mask> <mask> l := len(ent.Result.Rules) <mask> if l == 0 { <mask> ent.Result.Rules = []*filtering.ResultRule{{}} <mask> l++ <mask> } <mask> <mask> ent.Result.Rules[l-1].Text = s <mask> <mask> return nil <mask> }, <mask> "FilterID": func(t json.Token, ent *logEntry) error { <mask> n, ok := t.(json.Number) <mask> if !ok { <mask> return nil <mask> } <mask> <mask> i, err := n.Int64() <mask> if err != nil { <mask> return err <mask> } <mask> <mask> l := len(ent.Result.Rules) <mask> if l == 0 { <mask> ent.Result.Rules = []*filtering.ResultRule{{}} <mask> l++ <mask> } <mask> <mask> ent.Result.Rules[l-1].FilterListID = i <mask> <mask> return nil <mask> }, <mask> "Reason": func(t json.Token, ent *logEntry) error { <mask> v, ok := t.(json.Number) <mask> if !ok { <mask> return nil <mask> } <mask> i, err := v.Int64() <mask> if err != nil { <mask> return err <mask> } <mask> ent.Result.Reason = filtering.Reason(i) <mask> return nil <mask> }, <mask> "ServiceName": func(t json.Token, ent *logEntry) error { <mask> s, ok := t.(string) <mask> if !ok { <mask> return nil <mask> } <mask> <mask> ent.Result.ServiceName = s <mask> <mask> return nil <mask> }, <mask> "CanonName": func(t json.Token, ent *logEntry) error { <mask> s, ok := t.(string) <mask> if !ok { <mask> return nil <mask> } <mask> <mask> ent.Result.CanonName = s <mask> <mask> return nil <mask> }, <mask> } <mask> <mask> func decodeResultRuleKey(key string, i int, dec *json.Decoder, ent *logEntry) { <mask> var vToken json.Token <mask> switch key { <mask> case "FilterListID": <mask> ent.Result.Rules, vToken = decodeVTokenAndAddRule(key, i, dec, ent.Result.Rules) </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true) </s> remove if !needFlush { return nil } </s> add </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled { </s> remove switch key { case "ReverseHosts": decodeResultReverseHosts(dec, ent) </s> add decHandler, ok := resultDecHandlers[key] if ok { decHandler(dec, ent) </s> remove if err != nil { log.Error("querylog: writing to file: %s", err) </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/decode.go
keep keep replace replace replace keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace
<mask> } <mask> <mask> switch key { <mask> case "ReverseHosts": <mask> decodeResultReverseHosts(dec, ent) <mask> <mask> continue <mask> case "IPList": <mask> decodeResultIPList(dec, ent) <mask> <mask> continue <mask> case "Rules": <mask> decodeResultRules(dec, ent) <mask> <mask> continue <mask> case "DNSRewriteResult": <mask> decodeResultDNSRewriteResult(dec, ent) <mask> <mask> continue <mask> default: <mask> // Go on. </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add </s> remove // if buffer needs to be flushed to disk, do it now </s> add </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> add l.confMu.RLock() defer l.confMu.RUnlock()
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/decode.go
keep keep keep keep replace keep keep keep keep keep
<mask> package querylog <mask> <mask> import ( <mask> "fmt" <mask> "net" <mask> "os" <mask> "strings" <mask> "sync" <mask> "time" <mask> </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> add "github.com/AdguardTeam/golibs/stringutil" </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove rot.Format(time.RFC3339), </s> add rotTime.Format(time.RFC3339), </s> remove if rot, now := oldest.Add(l.conf.RotationIvl), time.Now(); rot.After(now) { </s> add if rotTime, now := oldest.Add(rotationIvl), time.Now(); rotTime.After(now) { </s> remove switch key { case "ReverseHosts": decodeResultReverseHosts(dec, ent) </s> add decHandler, ok := resultDecHandlers[key] if ok { decHandler(dec, ent) </s> remove case "IPList": decodeResultIPList(dec, ent) continue case "Rules": decodeResultRules(dec, ent) continue case "DNSRewriteResult": decodeResultDNSRewriteResult(dec, ent) continue default: // Go on. </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
keep keep add keep keep keep keep keep
<mask> "github.com/AdguardTeam/AdGuardHome/internal/filtering" <mask> "github.com/AdguardTeam/golibs/errors" <mask> "github.com/AdguardTeam/golibs/log" <mask> "github.com/AdguardTeam/golibs/timeutil" <mask> "github.com/miekg/dns" <mask> ) <mask> <mask> const ( </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove "net" </s> add </s> remove rot.Format(time.RFC3339), </s> add rotTime.Format(time.RFC3339), </s> remove if rot, now := oldest.Add(l.conf.RotationIvl), time.Now(); rot.After(now) { </s> add if rotTime, now := oldest.Add(rotationIvl), time.Now(); rotTime.After(now) { </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove case "IPList": decodeResultIPList(dec, ent) continue case "Rules": decodeResultRules(dec, ent) continue case "DNSRewriteResult": decodeResultDNSRewriteResult(dec, ent) continue default: // Go on. </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> return "", fmt.Errorf("invalid client proto: %q", s) <mask> } <mask> } <mask> <mask> // logEntry - represents a single log entry <mask> type logEntry struct { <mask> // client is the found client information, if any. <mask> client *Client <mask> <mask> Time time.Time `json:"T"` <mask> <mask> QHost string `json:"QH"` <mask> QType string `json:"QT"` <mask> QClass string `json:"QC"` <mask> <mask> ReqECS string `json:"ECS,omitempty"` <mask> <mask> ClientID string `json:"CID,omitempty"` <mask> ClientProto ClientProto `json:"CP"` <mask> <mask> Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net <mask> OrigAnswer []byte `json:",omitempty"` <mask> <mask> Result filtering.Result <mask> Upstream string `json:",omitempty"` <mask> <mask> IP net.IP `json:"IP"` <mask> <mask> Elapsed time.Duration <mask> <mask> Cached bool `json:",omitempty"` <mask> AuthenticatedData bool `json:"AD,omitempty"` <mask> } <mask> <mask> // shallowClone returns a shallow clone of e. <mask> func (e *logEntry) shallowClone() (clone *logEntry) { <mask> cloneVal := *e <mask> <mask> return &cloneVal <mask> } <mask> <mask> func (l *queryLog) Start() { <mask> if l.conf.HTTPRegister != nil { <mask> l.initWeb() <mask> } <mask> go l.periodicRotate() </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove // isIgnored returns true if the host is in the Ignored list. </s> add // isIgnored returns true if the host is in the ignored domains list. It // assumes that l.confMu is locked for reading. </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true) </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled {
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
keep keep keep keep replace keep keep keep keep keep
<mask> go l.periodicRotate() <mask> } <mask> <mask> func (l *queryLog) Close() { <mask> _ = l.flushLogBuffer(true) <mask> } <mask> <mask> func checkInterval(ivl time.Duration) (ok bool) { <mask> // The constants for possible values of query log's rotation interval. <mask> const ( </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove l.confMu.RLock() defer l.confMu.RUnlock() </s> add var rotationIvl time.Duration func() { l.confMu.RLock() defer l.confMu.RUnlock() rotationIvl = l.conf.RotationIvl }() </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove // if buffer needs to be flushed to disk, do it now </s> add </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove // logEntry - represents a single log entry type logEntry struct { // client is the found client information, if any. client *Client Time time.Time `json:"T"` QHost string `json:"QH"` QType string `json:"QT"` QClass string `json:"QC"` ReqECS string `json:"ECS,omitempty"` ClientID string `json:"CID,omitempty"` ClientProto ClientProto `json:"CP"` Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net OrigAnswer []byte `json:",omitempty"` Result filtering.Result Upstream string `json:",omitempty"` IP net.IP `json:"IP"` Elapsed time.Duration Cached bool `json:",omitempty"` AuthenticatedData bool `json:"AD,omitempty"` } // shallowClone returns a shallow clone of e. func (e *logEntry) shallowClone() (clone *logEntry) { cloneVal := *e return &cloneVal } </s> add </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w")
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
keep keep keep add keep keep keep keep keep keep
<mask> return nil <mask> } <mask> <mask> func (l *queryLog) WriteDiskConfig(c *Config) { <mask> *c = *l.conf <mask> <mask> // TODO(a.garipov): Add stringutil.Set.Clone. <mask> c.Ignored = stringutil.NewSet(l.conf.Ignored.Values()...) <mask> } <mask> </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> add // TODO(a.garipov): Add stringutil.Set.Clone. c.Ignored = stringutil.NewSet(l.conf.Ignored.Values()...) </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled { </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
keep keep add keep keep keep keep keep keep
<mask> defer l.confMu.RUnlock() <mask> <mask> *c = *l.conf <mask> } <mask> <mask> // Clear memory buffer and remove log files <mask> func (l *queryLog) clear() { <mask> l.fileFlushLock.Lock() <mask> defer l.fileFlushLock.Unlock() </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> add l.confMu.RLock() defer l.confMu.RUnlock() </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove l.confMu.RLock() defer l.confMu.RUnlock() </s> add var rotationIvl time.Duration func() { l.confMu.RLock() defer l.confMu.RUnlock() rotationIvl = l.conf.RotationIvl }() </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove // Flush the remainder to file. </s> add </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled {
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
keep keep keep keep replace keep keep keep keep keep
<mask> log.Debug("querylog: cleared") <mask> } <mask> <mask> func (l *queryLog) Add(params *AddParams) { <mask> if !l.conf.Enabled { <mask> return <mask> } <mask> <mask> err := params.validate() <mask> if err != nil { </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true) </s> remove if !needFlush { return nil } </s> add </s> remove if err != nil { log.Error("querylog: writing to file: %s", err) </s> add </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> now := time.Now() <mask> q := params.Question.Question[0] <mask> entry := logEntry{ <mask> Time: now, <mask> <mask> QHost: strings.ToLower(q.Name[:len(q.Name)-1]), <mask> QType: dns.Type(q.Qtype).String(), <mask> QClass: dns.Class(q.Qclass).String(), </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove if rot, now := oldest.Add(l.conf.RotationIvl), time.Now(); rot.After(now) { </s> add if rotTime, now := oldest.Add(rotationIvl), time.Now(); rotTime.After(now) { </s> remove // if buffer needs to be flushed to disk, do it now </s> add </s> remove rot.Format(time.RFC3339), </s> add rotTime.Format(time.RFC3339), </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove // logEntry - represents a single log entry type logEntry struct { // client is the found client information, if any. client *Client Time time.Time `json:"T"` QHost string `json:"QH"` QType string `json:"QT"` QClass string `json:"QC"` ReqECS string `json:"ECS,omitempty"` ClientID string `json:"CID,omitempty"` ClientProto ClientProto `json:"CP"` Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net OrigAnswer []byte `json:",omitempty"` Result filtering.Result Upstream string `json:",omitempty"` IP net.IP `json:"IP"` Elapsed time.Duration Cached bool `json:",omitempty"` AuthenticatedData bool `json:"AD,omitempty"` } // shallowClone returns a shallow clone of e. func (e *logEntry) shallowClone() (clone *logEntry) { cloneVal := *e return &cloneVal } </s> add </s> remove l.buffer = append(l.buffer, &entry) </s> add l.buffer = append(l.buffer, entry)
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> if params.ReqECS != nil { <mask> entry.ReqECS = params.ReqECS.String() <mask> } <mask> <mask> if params.Answer != nil { <mask> var a []byte <mask> a, err = params.Answer.Pack() <mask> if err != nil { <mask> log.Error("querylog: Answer.Pack(): %s", err) <mask> <mask> return <mask> } <mask> <mask> entry.Answer = a <mask> } <mask> <mask> if params.OrigAnswer != nil { <mask> var a []byte <mask> a, err = params.OrigAnswer.Pack() <mask> if err != nil { <mask> log.Error("querylog: OrigAnswer.Pack(): %s", err) <mask> <mask> return <mask> } <mask> <mask> entry.OrigAnswer = a <mask> } <mask> <mask> needFlush := false <mask> func() { <mask> l.bufferLock.Lock() <mask> defer l.bufferLock.Unlock() </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove if !needFlush { return nil } </s> add </s> remove if err != nil { log.Error("querylog: writing to file: %s", err) </s> add </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled { </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) if needFlush { flushBuffer = l.buffer l.buffer = nil l.flushPending = false } </s> add flushBuffer = l.buffer l.buffer = nil l.flushPending = false
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
keep keep keep keep replace keep replace replace keep keep keep keep
<mask> func() { <mask> l.bufferLock.Lock() <mask> defer l.bufferLock.Unlock() <mask> <mask> l.buffer = append(l.buffer, &entry) <mask> <mask> if !l.conf.FileEnabled { <mask> if len(l.buffer) > int(l.conf.MemSize) { <mask> // Writing to file is disabled, so just remove the oldest entry <mask> // from the slices. <mask> // <mask> // TODO(a.garipov): This should be replaced by a proper ring </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove needFlush := fullFlush </s> add </s> remove needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) if needFlush { flushBuffer = l.buffer l.buffer = nil l.flushPending = false } </s> add flushBuffer = l.buffer l.buffer = nil l.flushPending = false </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove // Flush the remainder to file. </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
keep keep keep keep replace keep keep keep keep keep
<mask> l.buffer[0] = nil <mask> l.buffer = l.buffer[1:] <mask> } <mask> } else if !l.flushPending { <mask> needFlush = len(l.buffer) >= int(l.conf.MemSize) <mask> if needFlush { <mask> l.flushPending = true <mask> } <mask> } <mask> }() </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) if needFlush { flushBuffer = l.buffer l.buffer = nil l.flushPending = false } </s> add flushBuffer = l.buffer l.buffer = nil l.flushPending = false </s> remove if !needFlush { return nil } </s> add </s> remove // if buffer needs to be flushed to disk, do it now </s> add </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true) </s> remove needFlush := fullFlush </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
keep keep keep replace keep keep replace keep
<mask> } <mask> }() <mask> <mask> // if buffer needs to be flushed to disk, do it now <mask> if needFlush { <mask> go func() { <mask> _ = l.flushLogBuffer(false) <mask> }() </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) if needFlush { flushBuffer = l.buffer l.buffer = nil l.flushPending = false } </s> add flushBuffer = l.buffer l.buffer = nil l.flushPending = false </s> remove needFlush = len(l.buffer) >= int(l.conf.MemSize) </s> add needFlush = len(l.buffer) >= int(memSize) </s> remove if !l.conf.FileEnabled { if len(l.buffer) > int(l.conf.MemSize) { </s> add if !fileIsEnabled { if len(l.buffer) > int(memSize) { </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove if !needFlush { return nil } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
keep keep keep keep replace keep keep keep
<mask> <mask> return !l.isIgnored(host) <mask> } <mask> <mask> // isIgnored returns true if the host is in the Ignored list. <mask> func (l *queryLog) isIgnored(host string) bool { <mask> return l.conf.Ignored.Has(host) <mask> } </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove // logEntry - represents a single log entry type logEntry struct { // client is the found client information, if any. client *Client Time time.Time `json:"T"` QHost string `json:"QH"` QType string `json:"QT"` QClass string `json:"QC"` ReqECS string `json:"ECS,omitempty"` ClientID string `json:"CID,omitempty"` ClientProto ClientProto `json:"CP"` Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net OrigAnswer []byte `json:",omitempty"` Result filtering.Result Upstream string `json:",omitempty"` IP net.IP `json:"IP"` Elapsed time.Duration Cached bool `json:",omitempty"` AuthenticatedData bool `json:"AD,omitempty"` } // shallowClone returns a shallow clone of e. func (e *logEntry) shallowClone() (clone *logEntry) { cloneVal := *e return &cloneVal } </s> add </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled { </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> add l.confMu.RLock() defer l.confMu.RUnlock()
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> // Add disk entries. <mask> addEntry(l, "example.org", net.IPv4(1, 1, 1, 1), net.IPv4(2, 2, 2, 1)) <mask> // Write to disk (first file). <mask> require.NoError(t, l.flushLogBuffer(true)) <mask> // Start writing to the second file. <mask> require.NoError(t, l.rotate()) <mask> // Add disk entries. <mask> addEntry(l, "example.org", net.IPv4(1, 1, 1, 2), net.IPv4(2, 2, 2, 2)) <mask> // Write to disk. </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> add // TODO(a.garipov): Add stringutil.Set.Clone. c.Ignored = stringutil.NewSet(l.conf.Ignored.Values()...) </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> add l.confMu.RLock() defer l.confMu.RUnlock()
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> require.NoError(t, l.rotate()) <mask> // Add disk entries. <mask> addEntry(l, "example.org", net.IPv4(1, 1, 1, 2), net.IPv4(2, 2, 2, 2)) <mask> // Write to disk. <mask> require.NoError(t, l.flushLogBuffer(true)) <mask> // Add memory entries. <mask> addEntry(l, "test.example.org", net.IPv4(1, 1, 1, 3), net.IPv4(2, 2, 2, 3)) <mask> addEntry(l, "example.com", net.IPv4(1, 1, 1, 4), net.IPv4(2, 2, 2, 4)) <mask> <mask> type tcAssertion struct { </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> add // TODO(a.garipov): Add stringutil.Set.Clone. c.Ignored = stringutil.NewSet(l.conf.Ignored.Values()...) </s> add l.confMu.RLock() defer l.confMu.RUnlock() </s> remove // logEntry - represents a single log entry type logEntry struct { // client is the found client information, if any. client *Client Time time.Time `json:"T"` QHost string `json:"QH"` QType string `json:"QT"` QClass string `json:"QC"` ReqECS string `json:"ECS,omitempty"` ClientID string `json:"CID,omitempty"` ClientProto ClientProto `json:"CP"` Answer []byte `json:",omitempty"` // sometimes empty answers happen like binerdunt.top or rev2.globalrootservers.net OrigAnswer []byte `json:",omitempty"` Result filtering.Result Upstream string `json:",omitempty"` IP net.IP `json:"IP"` Elapsed time.Duration Cached bool `json:",omitempty"` AuthenticatedData bool `json:"AD,omitempty"` } // shallowClone returns a shallow clone of e. func (e *logEntry) shallowClone() (clone *logEntry) { cloneVal := *e return &cloneVal } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> for i := 0; i < entNum; i++ { <mask> addEntry(l, secondPageDomain, net.IPv4(1, 1, 1, 1), net.IPv4(2, 2, 2, 1)) <mask> } <mask> // Write them to the first file. <mask> require.NoError(t, l.flushLogBuffer(true)) <mask> // Add more to the in-memory part of log. <mask> for i := 0; i < entNum; i++ { <mask> addEntry(l, firstPageDomain, net.IPv4(1, 1, 1, 1), net.IPv4(2, 2, 2, 1)) <mask> } <mask> </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog_test.go
keep keep keep keep replace keep keep keep keep keep
<mask> for i := 0; i < entNum; i++ { <mask> addEntry(l, "example.org", net.IPv4(1, 1, 1, 1), net.IPv4(2, 2, 2, 1)) <mask> } <mask> // Write them to disk. <mask> require.NoError(t, l.flushLogBuffer(true)) <mask> <mask> params := newSearchParams() <mask> <mask> for _, maxFileScanEntries := range []int{5, 0} { <mask> t.Run(fmt.Sprintf("limit_%d", maxFileScanEntries), func(t *testing.T) { </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove require.NoError(t, l.flushLogBuffer(true)) </s> add require.NoError(t, l.flushLogBuffer()) </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } }
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/qlog_test.go
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
<mask> ) <mask> <mask> // flushLogBuffer flushes the current buffer to file and resets the current <mask> // buffer. <mask> func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { <mask> if !l.conf.FileEnabled { <mask> return nil <mask> } <mask> <mask> l.fileFlushLock.Lock() <mask> defer l.fileFlushLock.Unlock() <mask> <mask> // Flush the remainder to file. <mask> var flushBuffer []*logEntry </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove // Flush the remainder to file. </s> add </s> remove needFlush := fullFlush </s> add </s> add // TODO(a.garipov): Add stringutil.Set.Clone. c.Ignored = stringutil.NewSet(l.conf.Ignored.Values()...) </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove l.buffer = append(l.buffer, &entry) </s> add l.buffer = append(l.buffer, entry) </s> remove if !l.conf.FileEnabled { if len(l.buffer) > int(l.conf.MemSize) { </s> add if !fileIsEnabled { if len(l.buffer) > int(memSize) {
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
keep keep keep keep replace keep replace keep keep keep keep
<mask> <mask> l.fileFlushLock.Lock() <mask> defer l.fileFlushLock.Unlock() <mask> <mask> // Flush the remainder to file. <mask> var flushBuffer []*logEntry <mask> needFlush := fullFlush <mask> func() { <mask> l.bufferLock.Lock() <mask> defer l.bufferLock.Unlock() <mask> </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) if needFlush { flushBuffer = l.buffer l.buffer = nil l.flushPending = false } </s> add flushBuffer = l.buffer l.buffer = nil l.flushPending = false </s> remove l.buffer = append(l.buffer, &entry) </s> add l.buffer = append(l.buffer, entry) </s> add // TODO(a.garipov): Add stringutil.Set.Clone. c.Ignored = stringutil.NewSet(l.conf.Ignored.Values()...) </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true)
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
keep replace replace replace replace replace replace keep replace replace replace keep keep
<mask> <mask> needFlush = needFlush || len(l.buffer) >= int(l.conf.MemSize) <mask> if needFlush { <mask> flushBuffer = l.buffer <mask> l.buffer = nil <mask> l.flushPending = false <mask> } <mask> }() <mask> if !needFlush { <mask> return nil <mask> } <mask> <mask> err = l.flushToFile(flushBuffer) </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove needFlush = len(l.buffer) >= int(l.conf.MemSize) </s> add needFlush = len(l.buffer) >= int(memSize) </s> remove needFlush := fullFlush </s> add </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true) </s> remove l.buffer = append(l.buffer, &entry) </s> add l.buffer = append(l.buffer, entry) </s> remove // if buffer needs to be flushed to disk, do it now </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
keep keep replace replace keep replace replace replace replace keep
<mask> <mask> err = l.flushToFile(flushBuffer) <mask> if err != nil { <mask> log.Error("querylog: writing to file: %s", err) <mask> <mask> return err <mask> } <mask> <mask> return nil <mask> } </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove if !needFlush { return nil } </s> add </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true) </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled {
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
keep keep keep keep replace replace keep keep keep keep keep
<mask> <mask> // checkAndRotate rotates log files if those are older than the specified <mask> // rotation interval. <mask> func (l *queryLog) checkAndRotate() { <mask> l.confMu.RLock() <mask> defer l.confMu.RUnlock() <mask> <mask> oldest, err := l.readFileFirstTimeValue() <mask> if err != nil && !errors.Is(err, os.ErrNotExist) { <mask> log.Error("querylog: reading oldest record for rotation: %s", err) <mask> </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove _ = l.flushLogBuffer(true) </s> add l.confMu.RLock() defer l.confMu.RUnlock() if l.conf.FileEnabled { err := l.flushLogBuffer() if err != nil { log.Error("querylog: closing: %s", err) } } </s> remove return err } return nil </s> add return errors.Annotate(err, "writing to file: %w") </s> remove if !l.conf.Enabled { </s> add var isEnabled, fileIsEnabled bool var memSize uint32 func() { l.confMu.RLock() defer l.confMu.RUnlock() isEnabled, fileIsEnabled = l.conf.Enabled, l.conf.FileEnabled memSize = l.conf.MemSize }() if !isEnabled { </s> add // TODO(a.garipov): Add stringutil.Set.Clone. c.Ignored = stringutil.NewSet(l.conf.Ignored.Values()...) </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true) </s> remove if err != nil { log.Error("querylog: writing to file: %s", err) </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
keep keep replace keep keep keep replace keep keep keep
<mask> } <mask> <mask> if rot, now := oldest.Add(l.conf.RotationIvl), time.Now(); rot.After(now) { <mask> log.Debug( <mask> "querylog: %s <= %s, not rotating", <mask> now.Format(time.RFC3339), <mask> rot.Format(time.RFC3339), <mask> ) <mask> <mask> return </s> Pull request 1797: AG-21072-querylog-conf-race Merge in DNS/adguard-home from AG-21072-querylog-conf-race to master Squashed commit of the following: commit fcb14353ee63f582986e18affebf5ed965c3bfc7 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 15:04:03 2023 +0300 querylog: imp code, docs commit 9070bc1d4eee5efc5795466b2c2a40c6ab495e68 Author: Ainar Garipov <[email protected]> Date: Mon Apr 3 13:58:56 2023 +0300 querylog: fix races </s> remove // if buffer needs to be flushed to disk, do it now </s> add </s> remove _ = l.flushLogBuffer(false) </s> add flushErr := l.flushLogBuffer() if flushErr != nil { log.Error("querylog: flushing after adding: %s", err) } </s> remove func (l *queryLog) flushLogBuffer(fullFlush bool) (err error) { if !l.conf.FileEnabled { return nil } </s> add func (l *queryLog) flushLogBuffer() (err error) { </s> remove var resultHandlers = map[string]logEntryHandler{ "IsFiltered": func(t json.Token, ent *logEntry) error { v, ok := t.(bool) if !ok { return nil } ent.Result.IsFiltered = v return nil }, "Rule": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].Text = s return nil }, "FilterID": func(t json.Token, ent *logEntry) error { n, ok := t.(json.Number) if !ok { return nil } i, err := n.Int64() if err != nil { return err } l := len(ent.Result.Rules) if l == 0 { ent.Result.Rules = []*filtering.ResultRule{{}} l++ } ent.Result.Rules[l-1].FilterListID = i return nil }, "Reason": func(t json.Token, ent *logEntry) error { v, ok := t.(json.Number) if !ok { return nil } i, err := v.Int64() if err != nil { return err } ent.Result.Reason = filtering.Reason(i) return nil }, "ServiceName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.ServiceName = s return nil }, "CanonName": func(t json.Token, ent *logEntry) error { s, ok := t.(string) if !ok { return nil } ent.Result.CanonName = s return nil }, } </s> add </s> remove if params.Answer != nil { var a []byte a, err = params.Answer.Pack() if err != nil { log.Error("querylog: Answer.Pack(): %s", err) return } entry.Answer = a } if params.OrigAnswer != nil { var a []byte a, err = params.OrigAnswer.Pack() if err != nil { log.Error("querylog: OrigAnswer.Pack(): %s", err) return } entry.OrigAnswer = a } </s> add entry.addResponse(params.Answer, false) entry.addResponse(params.OrigAnswer, true)
https://github.com/AdguardTeam/AdGuardHome/commit/2a0d06294734ba87549c8e13dfb7463706af90db
internal/querylog/querylogfile.go
replace replace keep keep keep keep keep
<mask> //go:build !(linux || darwin || freebsd || openbsd) <mask> // +build !linux,!darwin,!freebsd,!openbsd <mask> <mask> package aghnet <mask> <mask> import ( <mask> "io" </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err) </s> remove var tlsConf *tlsConfigSettings if runtime.GOOS != "windows" { tlsConf = &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) } </s> add tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) </s> add vr.CanAutoUpdate = &canUpdate return nil } // tlsConfUsesPrivilegedPorts returns true if the provided TLS configuration // indicates that privileged ports are used. func tlsConfUsesPrivilegedPorts(c *tlsConfigSettings) (ok bool) { return c.Enabled && (c.PortHTTPS < 1024 || c.PortDNSOverTLS < 1024 || c.PortDNSOverQUIC < 1024) </s> remove vr.CanAutoUpdate = &canUpdate </s> add </s> add Disabled bool `json:"disabled"` </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return }
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/aghnet/net_windows.go
keep add keep keep keep keep keep keep
<mask> ) <mask> <mask> func ifaceHasStaticIP(string) (ok bool, err error) { <mask> return false, aghos.Unsupported("checking static ip") <mask> } <mask> <mask> func ifaceSetStaticIP(string) (err error) { <mask> return aghos.Unsupported("setting static ip") </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> add Disabled bool `json:"disabled"` </s> add // requestVersionInfo sets the VersionInfo field of resp if it can reach the // update server. func requestVersionInfo(resp *versionResponse, recheck bool) (err error) { for i := 0; i != 3; i++ { resp.VersionInfo, err = Context.updater.VersionInfo(recheck) </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> add vr.CanAutoUpdate = &canUpdate return nil } // tlsConfUsesPrivilegedPorts returns true if the provided TLS configuration // indicates that privileged ports are used. func tlsConfUsesPrivilegedPorts(c *tlsConfigSettings) (ok bool) { return c.Enabled && (c.PortHTTPS < 1024 || c.PortDNSOverTLS < 1024 || c.PortDNSOverQUIC < 1024) </s> remove // TODO(a.garipov): Figure out the purpose of %T verb. aghhttp.Error( r, w, http.StatusBadGateway, "Couldn't get version check json from %s: %T %s\n", vcu, err, err, ) </s> add </s> remove return </s> add return fmt.Errorf("getting version info from %s: %s", vcu, err)
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/aghnet/net_windows.go
keep add keep keep keep keep keep
<mask> "context" <mask> "encoding/json" <mask> "net/http" <mask> "os" <mask> "os/exec" <mask> "path/filepath" <mask> "runtime" </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove CanAutoUpdate *bool `json:"can_autoupdate,omitempty"` </s> add </s> add CanAutoUpdate *bool `json:"can_autoupdate,omitempty"` </s> add func canBindPrivilegedPorts() (can bool, err error) { return true, nil } </s> add w.Header().Set("Content-Type", "application/json") </s> remove // w.Header().Set("Content-Type", "application/json") </s> add </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) }
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep keep add keep keep keep keep
<mask> <mask> // Get the latest available version from the Internet <mask> func handleGetVersionJSON(w http.ResponseWriter, r *http.Request) { <mask> resp := &versionResponse{} <mask> if Context.disableUpdate { <mask> resp.Disabled = true <mask> err := json.NewEncoder(w).Encode(resp) </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // w.Header().Set("Content-Type", "application/json") </s> add </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } </s> add // requestVersionInfo sets the VersionInfo field of resp if it can reach the // update server. func requestVersionInfo(resp *versionResponse, recheck bool) (err error) { for i := 0; i != 3; i++ { resp.VersionInfo, err = Context.updater.VersionInfo(recheck) </s> remove // TODO(a.garipov): Figure out the purpose of %T verb. aghhttp.Error( r, w, http.StatusBadGateway, "Couldn't get version check json from %s: %T %s\n", vcu, err, err, ) </s> add </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } }
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep keep replace keep replace replace
<mask> resp := &versionResponse{} <mask> if Context.disableUpdate { <mask> // w.Header().Set("Content-Type", "application/json") <mask> resp.Disabled = true <mask> _ = json.NewEncoder(w).Encode(resp) <mask> // TODO(e.burkov): Add error handling and deal with headers. </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> add w.Header().Set("Content-Type", "application/json") </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove vr.CanAutoUpdate = &canUpdate </s> add </s> add // requestVersionInfo sets the VersionInfo field of resp if it can reach the // update server. func requestVersionInfo(resp *versionResponse, recheck bool) (err error) { for i := 0; i != 3; i++ { resp.VersionInfo, err = Context.updater.VersionInfo(recheck) </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } }
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep keep keep keep replace keep keep keep keep keep
<mask> var err error <mask> if r.ContentLength != 0 { <mask> err = json.NewDecoder(r.Body).Decode(req) <mask> if err != nil { <mask> aghhttp.Error(r, w, http.StatusBadRequest, "JSON parse: %s", err) <mask> <mask> return <mask> } <mask> } <mask> </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } } </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove for i := 0; i != 3; i++ { func() { Context.controlLock.Lock() defer Context.controlLock.Unlock() </s> add err = requestVersionInfo(resp, req.Recheck) if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusBadGateway, "%s", err) return } </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err) </s> add // requestVersionInfo sets the VersionInfo field of resp if it can reach the // update server. func requestVersionInfo(resp *versionResponse, recheck bool) (err error) { for i := 0; i != 3; i++ { resp.VersionInfo, err = Context.updater.VersionInfo(recheck)
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep replace replace replace replace keep replace replace keep keep
<mask> <mask> for i := 0; i != 3; i++ { <mask> func() { <mask> Context.controlLock.Lock() <mask> defer Context.controlLock.Unlock() <mask> <mask> resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) <mask> }() <mask> <mask> if err != nil { </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> add // requestVersionInfo sets the VersionInfo field of resp if it can reach the // update server. func requestVersionInfo(resp *versionResponse, recheck bool) (err error) { for i := 0; i != 3; i++ { resp.VersionInfo, err = Context.updater.VersionInfo(recheck) </s> remove aghhttp.Error(r, w, http.StatusBadRequest, "JSON parse: %s", err) </s> add aghhttp.Error(r, w, http.StatusBadRequest, "parsing request: %s", err) </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err)
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep keep add keep keep keep keep
<mask> } <mask> } <mask> <mask> if err != nil { <mask> var terr temporaryError <mask> if errors.As(err, &terr) && terr.Temporary() { <mask> // Temporary network error. This case may happen while we're </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // Temporary network error. This case may happen while // we're restarting our DNS server. Log and sleep for // some time. </s> add // Temporary network error. This case may happen while we're // restarting our DNS server. Log and sleep for some time. </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } } </s> remove var tlsConf *tlsConfigSettings if runtime.GOOS != "windows" { tlsConf = &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) } </s> add tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> remove aghhttp.Error(r, w, http.StatusBadRequest, "JSON parse: %s", err) </s> add aghhttp.Error(r, w, http.StatusBadRequest, "parsing request: %s", err) </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err)
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep keep keep replace replace replace keep keep keep replace keep keep
<mask> if err != nil { <mask> var terr temporaryError <mask> if errors.As(err, &terr) && terr.Temporary() { <mask> // Temporary network error. This case may happen while <mask> // we're restarting our DNS server. Log and sleep for <mask> // some time. <mask> // <mask> // See https://github.com/AdguardTeam/AdGuardHome/issues/934. <mask> d := time.Duration(i) * time.Second <mask> log.Info("temp net error: %q; sleeping for %s and retrying", err, d) <mask> time.Sleep(d) <mask> </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> add // requestVersionInfo sets the VersionInfo field of resp if it can reach the // update server. func requestVersionInfo(resp *versionResponse, recheck bool) (err error) { for i := 0; i != 3; i++ { resp.VersionInfo, err = Context.updater.VersionInfo(recheck) </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } } </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } </s> remove // w.Header().Set("Content-Type", "application/json") </s> add </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return }
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep keep keep keep replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> break <mask> } <mask> if err != nil { <mask> vcu := Context.updater.VersionCheckURL() <mask> // TODO(a.garipov): Figure out the purpose of %T verb. <mask> aghhttp.Error( <mask> r, <mask> w, <mask> http.StatusBadGateway, <mask> "Couldn't get version check json from %s: %T %s\n", <mask> vcu, <mask> err, <mask> err, <mask> ) <mask> <mask> return <mask> } <mask> <mask> resp.confirmAutoUpdate() </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove return </s> add return fmt.Errorf("getting version info from %s: %s", vcu, err) </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove for i := 0; i != 3; i++ { func() { Context.controlLock.Lock() defer Context.controlLock.Unlock() </s> add err = requestVersionInfo(resp, req.Recheck) if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusBadGateway, "%s", err) return } </s> remove log.Info("temp net error: %q; sleeping for %s and retrying", err, d) </s> add log.Info("update: temp net error: %q; sleeping for %s and retrying", err, d) </s> remove // w.Header().Set("Content-Type", "application/json") </s> add </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } }
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep keep keep keep replace keep keep keep keep keep
<mask> err, <mask> err, <mask> ) <mask> <mask> return <mask> } <mask> <mask> resp.confirmAutoUpdate() <mask> <mask> w.Header().Set("Content-Type", "application/json") </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // TODO(a.garipov): Figure out the purpose of %T verb. aghhttp.Error( r, w, http.StatusBadGateway, "Couldn't get version check json from %s: %T %s\n", vcu, err, err, ) </s> add </s> remove log.Info("temp net error: %q; sleeping for %s and retrying", err, d) </s> add log.Info("update: temp net error: %q; sleeping for %s and retrying", err, d) </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> remove // w.Header().Set("Content-Type", "application/json") </s> add </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } </s> add w.Header().Set("Content-Type", "application/json")
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
<mask> <mask> return <mask> } <mask> <mask> resp.confirmAutoUpdate() <mask> <mask> w.Header().Set("Content-Type", "application/json") <mask> err = json.NewEncoder(w).Encode(resp) <mask> if err != nil { <mask> aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) <mask> } <mask> } <mask> <mask> // handleUpdate performs an update to the latest available version procedure. <mask> func handleUpdate(w http.ResponseWriter, r *http.Request) { <mask> if Context.updater.NewVersion() == "" { </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> add w.Header().Set("Content-Type", "application/json") </s> remove // w.Header().Set("Content-Type", "application/json") </s> add </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } } </s> remove aghhttp.Error(r, w, http.StatusBadRequest, "JSON parse: %s", err) </s> add aghhttp.Error(r, w, http.StatusBadRequest, "parsing request: %s", err) </s> remove // TODO(a.garipov): Figure out the purpose of %T verb. aghhttp.Error( r, w, http.StatusBadGateway, "Couldn't get version check json from %s: %T %s\n", vcu, err, err, ) </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> // versionResponse is the response for /control/version.json endpoint. <mask> type versionResponse struct { <mask> Disabled bool `json:"disabled"` <mask> updater.VersionInfo <mask> } <mask> <mask> // confirmAutoUpdate checks the real possibility of auto update. <mask> func (vr *versionResponse) confirmAutoUpdate() { </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> add Disabled bool `json:"disabled"` </s> add // requestVersionInfo sets the VersionInfo field of resp if it can reach the // update server. func requestVersionInfo(resp *versionResponse, recheck bool) (err error) { for i := 0; i != 3; i++ { resp.VersionInfo, err = Context.updater.VersionInfo(recheck) </s> remove var tlsConf *tlsConfigSettings if runtime.GOOS != "windows" { tlsConf = &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) } </s> add tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) </s> add CanAutoUpdate *bool `json:"can_autoupdate,omitempty"` </s> remove _ = json.NewEncoder(w).Encode(resp) // TODO(e.burkov): Add error handling and deal with headers. </s> add err := json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) }
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep add keep keep keep keep keep keep
<mask> type versionResponse struct { <mask> updater.VersionInfo <mask> } <mask> <mask> // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually <mask> // allowed to perform an automatic update by the OS. <mask> func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { <mask> if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> remove Disabled bool `json:"disabled"` </s> add </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> add // requestVersionInfo sets the VersionInfo field of resp if it can reach the // update server. func requestVersionInfo(resp *versionResponse, recheck bool) (err error) { for i := 0; i != 3; i++ { resp.VersionInfo, err = Context.updater.VersionInfo(recheck) </s> add vr.CanAutoUpdate = &canUpdate return nil } // tlsConfUsesPrivilegedPorts returns true if the provided TLS configuration // indicates that privileged ports are used. func tlsConfUsesPrivilegedPorts(c *tlsConfigSettings) (ok bool) { return c.Enabled && (c.PortHTTPS < 1024 || c.PortDNSOverTLS < 1024 || c.PortDNSOverQUIC < 1024) </s> remove var tlsConf *tlsConfigSettings if runtime.GOOS != "windows" { tlsConf = &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) } </s> add tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf)
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep keep keep keep replace replace replace replace keep replace replace replace replace replace keep keep
<mask> Disabled bool `json:"disabled"` <mask> updater.VersionInfo <mask> } <mask> <mask> // confirmAutoUpdate checks the real possibility of auto update. <mask> func (vr *versionResponse) confirmAutoUpdate() { <mask> if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { <mask> canUpdate := true <mask> <mask> var tlsConf *tlsConfigSettings <mask> if runtime.GOOS != "windows" { <mask> tlsConf = &tlsConfigSettings{} <mask> Context.tls.WriteDiskConfig(tlsConf) <mask> } <mask> <mask> if tlsConf != nil && </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove Disabled bool `json:"disabled"` </s> add </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err) </s> add Disabled bool `json:"disabled"` </s> add // requestVersionInfo sets the VersionInfo field of resp if it can reach the // update server. func requestVersionInfo(resp *versionResponse, recheck bool) (err error) { for i := 0; i != 3; i++ { resp.VersionInfo, err = Context.updater.VersionInfo(recheck) </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } }
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep replace replace replace replace replace replace replace keep replace keep keep keep
<mask> <mask> if tlsConf != nil && <mask> ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || <mask> tlsConf.PortDNSOverTLS < 1024 || <mask> tlsConf.PortDNSOverQUIC < 1024)) || <mask> config.BindPort < 1024 || <mask> config.DNS.Port < 1024) { <mask> canUpdate, _ = aghnet.CanBindPrivilegedPorts() <mask> } <mask> vr.CanAutoUpdate = &canUpdate <mask> } <mask> } <mask> </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove var tlsConf *tlsConfigSettings if runtime.GOOS != "windows" { tlsConf = &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) } </s> add tlsConf := &tlsConfigSettings{} Context.tls.WriteDiskConfig(tlsConf) </s> add vr.CanAutoUpdate = &canUpdate return nil } // tlsConfUsesPrivilegedPorts returns true if the provided TLS configuration // indicates that privileged ports are used. func tlsConfUsesPrivilegedPorts(c *tlsConfigSettings) (ok bool) { return c.Enabled && (c.PortHTTPS < 1024 || c.PortDNSOverTLS < 1024 || c.PortDNSOverQUIC < 1024) </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> add Disabled bool `json:"disabled"` </s> remove resp.VersionInfo, err = Context.updater.VersionInfo(req.Recheck) }() </s> add err = resp.setAllowedToAutoUpdate() if err != nil { // Don't wrap the error, because it's informative enough as is. aghhttp.Error(r, w, http.StatusInternalServerError, "%s", err) return } err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "writing body: %s", err) } }
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep keep add keep keep keep keep keep keep
<mask> return fmt.Errorf("checking ability to bind privileged ports: %w", err) <mask> } <mask> } <mask> } <mask> <mask> // finishUpdate completes an update procedure. <mask> func finishUpdate(ctx context.Context) { <mask> log.Info("Stopping all tasks") <mask> cleanup(ctx) </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove vr.CanAutoUpdate = &canUpdate </s> add </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err) </s> remove resp.confirmAutoUpdate() w.Header().Set("Content-Type", "application/json") err = json.NewEncoder(w).Encode(resp) if err != nil { aghhttp.Error(r, w, http.StatusInternalServerError, "Couldn't write body: %s", err) } </s> add return nil </s> add Disabled bool `json:"disabled"` </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> add // requestVersionInfo sets the VersionInfo field of resp if it can reach the // update server. func requestVersionInfo(resp *versionResponse, recheck bool) (err error) { for i := 0; i != 3; i++ { resp.VersionInfo, err = Context.updater.VersionInfo(recheck)
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/home/controlupdate.go
keep keep keep add keep keep keep keep
<mask> const versionCheckPeriod = 8 * time.Hour <mask> <mask> // VersionInfo contains information about a new version. <mask> type VersionInfo struct { <mask> NewVersion string `json:"new_version,omitempty"` <mask> Announcement string `json:"announcement,omitempty"` <mask> AnnouncementURL string `json:"announcement_url,omitempty"` <mask> SelfUpdateMinVersion string `json:"-"` </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> remove CanAutoUpdate *bool `json:"can_autoupdate,omitempty"` </s> add </s> add // requestVersionInfo sets the VersionInfo field of resp if it can reach the // update server. func requestVersionInfo(resp *versionResponse, recheck bool) (err error) { for i := 0; i != 3; i++ { resp.VersionInfo, err = Context.updater.VersionInfo(recheck) </s> remove Disabled bool `json:"disabled"` </s> add </s> add Disabled bool `json:"disabled"` </s> remove // Temporary network error. This case may happen while // we're restarting our DNS server. Log and sleep for // some time. </s> add // Temporary network error. This case may happen while we're // restarting our DNS server. Log and sleep for some time. </s> remove log.Info("temp net error: %q; sleeping for %s and retrying", err, d) </s> add log.Info("update: temp net error: %q; sleeping for %s and retrying", err, d)
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/updater/check.go
keep keep keep keep replace keep keep keep keep keep
<mask> NewVersion string `json:"new_version,omitempty"` <mask> Announcement string `json:"announcement,omitempty"` <mask> AnnouncementURL string `json:"announcement_url,omitempty"` <mask> SelfUpdateMinVersion string `json:"-"` <mask> CanAutoUpdate *bool `json:"can_autoupdate,omitempty"` <mask> } <mask> <mask> // MaxResponseSize is responses on server's requests maximum length in bytes. <mask> const MaxResponseSize = 64 * 1024 <mask> </s> Pull request: home: rm unnecessary locking in update; refactor Merge in DNS/adguard-home from 4499-rm-unnecessary-locking to master Squashed commit of the following: commit 6d70472506dd0fd69225454c73d9f7f6a208b76b Author: Ainar Garipov <[email protected]> Date: Mon Apr 25 17:26:54 2022 +0300 home: rm unnecessary locking in update; refactor </s> add CanAutoUpdate *bool `json:"can_autoupdate,omitempty"` </s> add Disabled bool `json:"disabled"` </s> remove // confirmAutoUpdate checks the real possibility of auto update. func (vr *versionResponse) confirmAutoUpdate() { if vr.CanAutoUpdate != nil && *vr.CanAutoUpdate { canUpdate := true </s> add // setAllowedToAutoUpdate sets CanAutoUpdate to true if AdGuard Home is actually // allowed to perform an automatic update by the OS. func (vr *versionResponse) setAllowedToAutoUpdate() (err error) { if vr.CanAutoUpdate == nil || !*vr.CanAutoUpdate { return } </s> remove vr.CanAutoUpdate = &canUpdate </s> add </s> remove if tlsConf != nil && ((tlsConf.Enabled && (tlsConf.PortHTTPS < 1024 || tlsConf.PortDNSOverTLS < 1024 || tlsConf.PortDNSOverQUIC < 1024)) || config.BindPort < 1024 || config.DNS.Port < 1024) { canUpdate, _ = aghnet.CanBindPrivilegedPorts() </s> add canUpdate := true if tlsConfUsesPrivilegedPorts(tlsConf) || config.BindPort < 1024 || config.DNS.Port < 1024 { canUpdate, err = aghnet.CanBindPrivilegedPorts() if err != nil { return fmt.Errorf("checking ability to bind privileged ports: %w", err) </s> add vr.CanAutoUpdate = &canUpdate return nil } // tlsConfUsesPrivilegedPorts returns true if the provided TLS configuration // indicates that privileged ports are used. func tlsConfUsesPrivilegedPorts(c *tlsConfigSettings) (ok bool) { return c.Enabled && (c.PortHTTPS < 1024 || c.PortDNSOverTLS < 1024 || c.PortDNSOverQUIC < 1024)
https://github.com/AdguardTeam/AdGuardHome/commit/2a1ad532f454ed2ab25d19eaf168ba9f6d534f2f
internal/updater/check.go
keep add keep keep keep keep keep keep
<mask> }; <mask> <mask> export const dnsStatusRequest = createAction('DNS_STATUS_REQUEST'); <mask> export const dnsStatusFailure = createAction('DNS_STATUS_FAILURE'); <mask> export const dnsStatusSuccess = createAction('DNS_STATUS_SUCCESS'); <mask> <mask> export const getDnsStatus = () => async (dispatch) => { <mask> dispatch(dnsStatusRequest()); </s> + client: get profile info </s> add // Profile GET_PROFILE = { path: 'profile', method: 'GET' }; getProfile() { const { path, method } = this.GET_PROFILE; return this.makeRequest(path, method); } </s> add name: '', </s> add dispatch(getProfile()); </s> add [actions.getProfileRequest]: state => ({ ...state, processingProfile: true }), [actions.getProfileFailure]: state => ({ ...state, processingProfile: false }), [actions.getProfileSuccess]: (state, { payload }) => ({ ...state, name: payload.name, processingProfile: false, }), </s> add processingProfile: true, </s> remove <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> </s> add {!dashboard.processingProfile && dashboard.name && <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> }
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/actions/index.js
keep keep keep add keep keep keep keep
<mask> const dnsStatus = await apiClient.getGlobalStatus(); <mask> dispatch(dnsStatusSuccess(dnsStatus)); <mask> dispatch(getVersion()); <mask> dispatch(getTlsStatus()); <mask> } catch (error) { <mask> dispatch(addErrorToast({ error })); <mask> dispatch(dnsStatusFailure()); <mask> } </s> + client: get profile info </s> add export const getProfileRequest = createAction('GET_PROFILE_REQUEST'); export const getProfileFailure = createAction('GET_PROFILE_FAILURE'); export const getProfileSuccess = createAction('GET_PROFILE_SUCCESS'); export const getProfile = () => async (dispatch) => { dispatch(getProfileRequest()); try { const profile = await apiClient.getProfile(); dispatch(getProfileSuccess(profile)); } catch (error) { dispatch(addErrorToast({ error })); dispatch(getProfileFailure()); } }; </s> add // Profile GET_PROFILE = { path: 'profile', method: 'GET' }; getProfile() { const { path, method } = this.GET_PROFILE; return this.makeRequest(path, method); } </s> add name: '', </s> remove <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> </s> add {!dashboard.processingProfile && dashboard.name && <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> } </s> add [actions.getProfileRequest]: state => ({ ...state, processingProfile: true }), [actions.getProfileFailure]: state => ({ ...state, processingProfile: false }), [actions.getProfileSuccess]: (state, { payload }) => ({ ...state, name: payload.name, processingProfile: false, }), </s> add processingProfile: true,
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/actions/index.js
keep keep keep add keep keep keep keep
<mask> headers: { 'Content-Type': 'application/json' }, <mask> }; <mask> return this.makeRequest(path, method, config); <mask> } <mask> } <mask> <mask> const apiClient = new Api(); <mask> export default apiClient; </s> + client: get profile info </s> add export const getProfileRequest = createAction('GET_PROFILE_REQUEST'); export const getProfileFailure = createAction('GET_PROFILE_FAILURE'); export const getProfileSuccess = createAction('GET_PROFILE_SUCCESS'); export const getProfile = () => async (dispatch) => { dispatch(getProfileRequest()); try { const profile = await apiClient.getProfile(); dispatch(getProfileSuccess(profile)); } catch (error) { dispatch(addErrorToast({ error })); dispatch(getProfileFailure()); } }; </s> add dispatch(getProfile()); </s> add name: '', </s> add [actions.getProfileRequest]: state => ({ ...state, processingProfile: true }), [actions.getProfileFailure]: state => ({ ...state, processingProfile: false }), [actions.getProfileSuccess]: (state, { payload }) => ({ ...state, name: payload.name, processingProfile: false, }), </s> remove <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> </s> add {!dashboard.processingProfile && dashboard.name && <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> } </s> add processingProfile: true,
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/api/Api.js
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> closeMenu={this.closeMenu} <mask> /> <mask> <div className="header__column"> <mask> <div className="header__right"> <mask> <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <mask> <Trans>sign_out</Trans> <mask> </a> <mask> </div> <mask> </div> <mask> </div> <mask> </div> <mask> </div> </s> + client: get profile info </s> add name: '', </s> add processingProfile: true, </s> add [actions.getProfileRequest]: state => ({ ...state, processingProfile: true }), [actions.getProfileFailure]: state => ({ ...state, processingProfile: false }), [actions.getProfileSuccess]: (state, { payload }) => ({ ...state, name: payload.name, processingProfile: false, }), </s> add // Profile GET_PROFILE = { path: 'profile', method: 'GET' }; getProfile() { const { path, method } = this.GET_PROFILE; return this.makeRequest(path, method); } </s> add dispatch(getProfile()); </s> add export const getProfileRequest = createAction('GET_PROFILE_REQUEST'); export const getProfileFailure = createAction('GET_PROFILE_FAILURE'); export const getProfileSuccess = createAction('GET_PROFILE_SUCCESS'); export const getProfile = () => async (dispatch) => { dispatch(getProfileRequest()); try { const profile = await apiClient.getProfile(); dispatch(getProfileSuccess(profile)); } catch (error) { dispatch(addErrorToast({ error })); dispatch(getProfileFailure()); } };
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/components/Header/index.js
keep keep keep add keep keep keep keep keep
<mask> bootstrapDns: (bootstrapDns && bootstrapDns.join('\n')) || '', <mask> processingDnsSettings: false, <mask> }; <mask> }, <mask> }, <mask> { <mask> processing: true, <mask> isCoreRunning: false, <mask> processingVersion: true, </s> + client: get profile info </s> add processingProfile: true, </s> add name: '', </s> add // Profile GET_PROFILE = { path: 'profile', method: 'GET' }; getProfile() { const { path, method } = this.GET_PROFILE; return this.makeRequest(path, method); } </s> remove <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> </s> add {!dashboard.processingProfile && dashboard.name && <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> } </s> add export const getProfileRequest = createAction('GET_PROFILE_REQUEST'); export const getProfileFailure = createAction('GET_PROFILE_FAILURE'); export const getProfileSuccess = createAction('GET_PROFILE_SUCCESS'); export const getProfile = () => async (dispatch) => { dispatch(getProfileRequest()); try { const profile = await apiClient.getProfile(); dispatch(getProfileSuccess(profile)); } catch (error) { dispatch(addErrorToast({ error })); dispatch(getProfileFailure()); } }; </s> add dispatch(getProfile());
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/reducers/index.js
keep add keep keep keep keep keep keep
<mask> processingUpdate: false, <mask> processingDnsSettings: true, <mask> upstreamDns: '', <mask> bootstrapDns: '', <mask> allServers: false, <mask> protectionEnabled: false, <mask> processingProtection: false, <mask> httpPort: 80, </s> + client: get profile info </s> add [actions.getProfileRequest]: state => ({ ...state, processingProfile: true }), [actions.getProfileFailure]: state => ({ ...state, processingProfile: false }), [actions.getProfileSuccess]: (state, { payload }) => ({ ...state, name: payload.name, processingProfile: false, }), </s> add name: '', </s> remove <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> </s> add {!dashboard.processingProfile && dashboard.name && <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> } </s> add // Profile GET_PROFILE = { path: 'profile', method: 'GET' }; getProfile() { const { path, method } = this.GET_PROFILE; return this.makeRequest(path, method); } </s> add dispatch(getProfile()); </s> add export const getProfileRequest = createAction('GET_PROFILE_REQUEST'); export const getProfileFailure = createAction('GET_PROFILE_FAILURE'); export const getProfileSuccess = createAction('GET_PROFILE_SUCCESS'); export const getProfile = () => async (dispatch) => { dispatch(getProfileRequest()); try { const profile = await apiClient.getProfile(); dispatch(getProfileSuccess(profile)); } catch (error) { dispatch(addErrorToast({ error })); dispatch(getProfileFailure()); } };
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/reducers/index.js
keep keep keep add keep keep keep keep keep
<mask> dnsAddresses: [], <mask> dnsVersion: '', <mask> clients: [], <mask> autoClients: [], <mask> }, <mask> ); <mask> <mask> const dhcp = handleActions( <mask> { </s> + client: get profile info </s> add export const getProfileRequest = createAction('GET_PROFILE_REQUEST'); export const getProfileFailure = createAction('GET_PROFILE_FAILURE'); export const getProfileSuccess = createAction('GET_PROFILE_SUCCESS'); export const getProfile = () => async (dispatch) => { dispatch(getProfileRequest()); try { const profile = await apiClient.getProfile(); dispatch(getProfileSuccess(profile)); } catch (error) { dispatch(addErrorToast({ error })); dispatch(getProfileFailure()); } }; </s> add // Profile GET_PROFILE = { path: 'profile', method: 'GET' }; getProfile() { const { path, method } = this.GET_PROFILE; return this.makeRequest(path, method); } </s> add dispatch(getProfile()); </s> add [actions.getProfileRequest]: state => ({ ...state, processingProfile: true }), [actions.getProfileFailure]: state => ({ ...state, processingProfile: false }), [actions.getProfileSuccess]: (state, { payload }) => ({ ...state, name: payload.name, processingProfile: false, }), </s> add processingProfile: true, </s> remove <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> </s> add {!dashboard.processingProfile && dashboard.name && <a href="/control/logout" className="btn btn-sm btn-outline-secondary"> <Trans>sign_out</Trans> </a> }
https://github.com/AdguardTeam/AdGuardHome/commit/2a2647dc3f4fa69dc1cab755607193df3fc19f62
client/src/reducers/index.js
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
<mask> <mask> netIfaces := []net.Interface{} <mask> <mask> for i := range ifaces { <mask> if ifaces[i].Flags&net.FlagPointToPoint != 0 { <mask> // this interface is ppp, we're not interested in this one <mask> continue <mask> } <mask> <mask> iface := ifaces[i] <mask> netIfaces = append(netIfaces, iface) <mask> } <mask> <mask> return netIfaces, nil </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> remove // check if error is "address already in use" </s> add // ErrorIsAddrInUse - check if error is "address already in use" </s> remove // Get interface name by its IP address. </s> add // GetInterfaceByIP - Get interface name by its IP address. </s> remove // Get IP address with netmask for the specified interface </s> add // GetSubnet - Get IP address with netmask for the specified interface </s> remove // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily </s> add // CheckPortAvailable - check if TCP port is available </s> remove // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only </s> add // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only </s> add // CheckPacketPortAvailable - check if UDP port is available
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> return netIfaces, nil <mask> } <mask> <mask> // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only <mask> // we do not return link-local addresses here <mask> func GetValidNetInterfacesForWeb() ([]NetInterface, error) { <mask> ifaces, err := GetValidNetInterfaces() <mask> if err != nil { <mask> return nil, errorx.Decorate(err, "Couldn't get interfaces") </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> remove // Get IP address with netmask for the specified interface </s> add // GetSubnet - Get IP address with netmask for the specified interface </s> remove // Get interface name by its IP address. </s> add // GetInterfaceByIP - Get interface name by its IP address. </s> add // CheckPacketPortAvailable - check if UDP port is available </s> remove // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily </s> add // CheckPortAvailable - check if TCP port is available </s> remove // check if error is "address already in use" </s> add // ErrorIsAddrInUse - check if error is "address already in use" </s> remove if ifaces[i].Flags&net.FlagPointToPoint != 0 { // this interface is ppp, we're not interested in this one continue } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> return netInterfaces, nil <mask> } <mask> <mask> // Get interface name by its IP address. <mask> func GetInterfaceByIP(ip string) string { <mask> ifaces, err := GetValidNetInterfacesForWeb() <mask> if err != nil { <mask> return "" <mask> } </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> remove // Get IP address with netmask for the specified interface </s> add // GetSubnet - Get IP address with netmask for the specified interface </s> remove // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only </s> add // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only </s> add // CheckPacketPortAvailable - check if UDP port is available </s> remove // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily </s> add // CheckPortAvailable - check if TCP port is available </s> remove if ifaces[i].Flags&net.FlagPointToPoint != 0 { // this interface is ppp, we're not interested in this one continue } </s> add </s> remove // check if error is "address already in use" </s> add // ErrorIsAddrInUse - check if error is "address already in use"
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> return "" <mask> } <mask> <mask> // Get IP address with netmask for the specified interface <mask> // Returns an empty string if it fails to find it <mask> func GetSubnet(ifaceName string) string { <mask> netIfaces, err := GetValidNetInterfacesForWeb() <mask> if err != nil { <mask> log.Error("Could not get network interfaces info: %v", err) </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> remove // Get interface name by its IP address. </s> add // GetInterfaceByIP - Get interface name by its IP address. </s> remove // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only </s> add // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only </s> remove // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily </s> add // CheckPortAvailable - check if TCP port is available </s> add // CheckPacketPortAvailable - check if UDP port is available </s> remove if ifaces[i].Flags&net.FlagPointToPoint != 0 { // this interface is ppp, we're not interested in this one continue } </s> add </s> remove // check if error is "address already in use" </s> add // ErrorIsAddrInUse - check if error is "address already in use"
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> return "" <mask> } <mask> <mask> // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily <mask> func CheckPortAvailable(host string, port int) error { <mask> ln, err := net.Listen("tcp", net.JoinHostPort(host, strconv.Itoa(port))) <mask> if err != nil { <mask> return err <mask> } </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> add // CheckPacketPortAvailable - check if UDP port is available </s> remove // Get IP address with netmask for the specified interface </s> add // GetSubnet - Get IP address with netmask for the specified interface </s> remove // check if error is "address already in use" </s> add // ErrorIsAddrInUse - check if error is "address already in use" </s> remove // Get interface name by its IP address. </s> add // GetInterfaceByIP - Get interface name by its IP address. </s> remove // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only </s> add // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only </s> remove if ifaces[i].Flags&net.FlagPointToPoint != 0 { // this interface is ppp, we're not interested in this one continue } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
keep add keep keep keep keep
<mask> } <mask> <mask> func CheckPacketPortAvailable(host string, port int) error { <mask> ln, err := net.ListenPacket("udp", net.JoinHostPort(host, strconv.Itoa(port))) <mask> if err != nil { <mask> return err </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> remove // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily </s> add // CheckPortAvailable - check if TCP port is available </s> remove // Get interface name by its IP address. </s> add // GetInterfaceByIP - Get interface name by its IP address. </s> remove // check if error is "address already in use" </s> add // ErrorIsAddrInUse - check if error is "address already in use" </s> remove // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only </s> add // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only </s> remove // Get IP address with netmask for the specified interface </s> add // GetSubnet - Get IP address with netmask for the specified interface </s> remove if ifaces[i].Flags&net.FlagPointToPoint != 0 { // this interface is ppp, we're not interested in this one continue } </s> add
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
keep keep keep keep replace keep keep keep keep keep
<mask> time.Sleep(100 * time.Millisecond) <mask> return err <mask> } <mask> <mask> // check if error is "address already in use" <mask> func ErrorIsAddrInUse(err error) bool { <mask> errOpError, ok := err.(*net.OpError) <mask> if !ok { <mask> return false <mask> } </s> * GetValidNetInterfaces: don't skip PointToPoint interfaces </s> add // CheckPacketPortAvailable - check if UDP port is available </s> remove // checkPortAvailable is not a cheap test to see if the port is bindable, because it's actually doing the bind momentarily </s> add // CheckPortAvailable - check if TCP port is available </s> remove if ifaces[i].Flags&net.FlagPointToPoint != 0 { // this interface is ppp, we're not interested in this one continue } </s> add </s> remove // getValidNetInterfacesMap returns interfaces that are eligible for DNS and WEB only </s> add // GetValidNetInterfacesForWeb returns interfaces that are eligible for DNS and WEB only </s> remove // Get interface name by its IP address. </s> add // GetInterfaceByIP - Get interface name by its IP address. </s> remove // Get IP address with netmask for the specified interface </s> add // GetSubnet - Get IP address with netmask for the specified interface
https://github.com/AdguardTeam/AdGuardHome/commit/2b1919137d88902d0cfc0cc8f480274e18b2d109
util/network_utils.go
keep keep keep add keep keep keep keep
<mask> "example_comment_meaning": "hanya sebuah komentar;", <mask> "example_comment_hash": "# Juga sebuah komentar.", <mask> "example_regex_meaning": "blokir akses ke domain yang cocok dengan ekspresi reguler yang ditentukan.", <mask> "example_upstream_regular": "DNS reguler (melalui UDP);", <mask> "example_upstream_udp": "DNS biasa (lebih dari UDP, nama host);", <mask> "example_upstream_dot": "terenkripsi <0>DNS-over-TLS</0>;", <mask> "example_upstream_doh": "terenkripsi <0>DNS-over-HTTPS</0>;", <mask> "example_upstream_doq": "terenkripsi <0>DNS-over-QUIC</0>;", </s> Pull request: upd-i18n Merge in DNS/adguard-home from upd-i18n to master Squashed commit of the following: commit e32d907806f29d78d91a9962f7d0a7ba1f17f5a5 Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 15:01:22 2022 +0300 client: imp be locale commit 4701b98b4115b66cf5decda4e43d4e4d459b95ad Author: Ainar Garipov <[email protected]> Date: Wed Sep 7 14:57:27 2022 +0300 client: upd i18n </s> add "example_upstream_tcp_port": "DNS biasa (melalui TCP, dengan port);", </s> add "example_upstream_regular_port": "DNS regolare (su UDP, con porta);", </s> add "example_upstream_regular_port": "standaard DNS (via UDP, met poort);", </s> remove "dns_allowlists": "DNS toestemmingslijsten", </s> add "dns_allowlists": "DNS-toelatingslijsten", </s> remove "dns_allowlists_desc": "Domeinen in de DNS toestemmingslijsten worden toegestaan zelfs al komen ze voor in de blokkeerlijsten.", </s> add "dns_allowlists_desc": "Domeinen van DNS-toelatingslijsten zijn toegestaan, zelfs als ze op een van de blokkeerlijsten staan.", </s> add "example_upstream_tcp_port": "standaard DNS (via TCP, met poort);",
https://github.com/AdguardTeam/AdGuardHome/commit/2b4158e5c90bcde7cb25953f32e58f1822d2fb8f
client/src/__locales/id.json