repo stringlengths 6 47 | file_url stringlengths 77 269 | file_path stringlengths 5 186 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-07 08:35:43 2026-01-07 08:55:24 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/quantile.go | promql/quantile.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/fuzz_test.go | promql/fuzz_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/value_test.go | promql/value_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/query_logger.go | promql/query_logger.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/histogram_stats_iterator.go | promql/histogram_stats_iterator.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/durations.go | promql/durations.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/histogram_stats_iterator_test.go | promql/histogram_stats_iterator_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/engine_test.go | promql/engine_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | true |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/bench_test.go | promql/bench_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/functions_internal_test.go | promql/functions_internal_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/value.go | promql/value.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/functions.go | promql/functions.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | true |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/engine.go | promql/engine.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | true |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/functions_test.go | promql/functions_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/query_logger_test.go | promql/query_logger_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/quantile_test.go | promql/quantile_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/engine_internal_test.go | promql/engine_internal_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/info.go | promql/info.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/promql_test.go | promql/promql_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/durations_test.go | promql/durations_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/promqltest/test_migrate.go | promql/promqltest/test_migrate.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/promqltest/test.go | promql/promqltest/test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | true |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/promqltest/test_test.go | promql/promqltest/test_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | true |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/promqltest/test_migrate_test.go | promql/promqltest/test_migrate_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/promqltest/cmd/migrate/main.go | promql/promqltest/cmd/migrate/main.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/lex_test.go | promql/parser/lex_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/features.go | promql/parser/features.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/lex.go | promql/parser/lex.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/generated_parser.y.go | promql/parser/generated_parser.y.go | // Code generated by goyacc -l -o promql/parser/generated_parser.y.go promql/parser/generated_parser.y. DO NOT EDIT.
package parser
import __yyfmt__ "fmt"
import (
"math"
"strconv"
"time"
"github.com/prometheus/prometheus/model/histogram"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/p... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | true |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/printer.go | promql/parser/printer.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/prettier_test.go | promql/parser/prettier_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/parse_test.go | promql/parser/parse_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | true |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/value.go | promql/parser/value.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/ast.go | promql/parser/ast.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/functions.go | promql/parser/functions.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/parse.go | promql/parser/parse.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | true |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/printer_test.go | promql/parser/printer_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/prettier.go | promql/parser/prettier.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/promql/parser/posrange/posrange.go | promql/parser/posrange/posrange.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/web_test.go | web/web_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/federate.go | web/federate.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/web.go | web/web.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/federate_test.go | web/federate_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/api/v1/errors_test.go | web/api/v1/errors_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/api/v1/api.go | web/api/v1/api.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | true |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/api/v1/json_codec_test.go | web/api/v1/json_codec_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/api/v1/api_test.go | web/api/v1/api_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | true |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/api/v1/json_codec.go | web/api/v1/json_codec.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/api/v1/codec_test.go | web/api/v1/codec_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/api/v1/codec.go | web/api/v1/codec.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/api/v1/translate_ast.go | web/api/v1/translate_ast.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/ui/assets_embed.go | web/ui/assets_embed.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/ui/ui.go | web/ui/ui.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/ui/mantine-ui/src/promql/tools/gen_functions_list/main.go | web/ui/mantine-ui/src/promql/tools/gen_functions_list/main.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/web/ui/mantine-ui/src/promql/tools/gen_functions_docs/main.go | web/ui/mantine-ui/src/promql/tools/gen_functions_docs/main.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/scrape/manager_test.go | scrape/manager_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | true |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/scrape/scrape.go | scrape/scrape.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | true |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/scrape/scrape_test.go | scrape/scrape_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | true |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/scrape/metrics.go | scrape/metrics.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/scrape/helpers_test.go | scrape/helpers_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/scrape/clientprotobuf.go | scrape/clientprotobuf.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/scrape/target_test.go | scrape/target_test.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/scrape/target.go | scrape/target.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
prometheus/prometheus | https://github.com/prometheus/prometheus/blob/66bdc88013e6c6098da7026ce828d3b33235d527/scrape/manager.go | scrape/manager.go | // Copyright The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in w... | go | Apache-2.0 | 66bdc88013e6c6098da7026ce828d3b33235d527 | 2026-01-07T08:35:43.488477Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/main.go | main.go | package main
import (
"fmt"
"github.com/urfave/cli/v2"
"heckel.io/ntfy/v2/cmd"
"os"
"runtime"
)
var (
version = "dev"
commit = "unknown"
date = "unknown"
)
func main() {
cli.AppHelpTemplate += fmt.Sprintf(`
Try 'ntfy COMMAND --help' or https://ntfy.sh/docs/ for more information.
To report a bug, open a... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/payments/payments.go | payments/payments.go | //go:build !nopayments
package payments
import "github.com/stripe/stripe-go/v74"
// Available is a constant used to indicate that Stripe support is available.
// It can be disabled with the 'nopayments' build tag.
const Available = true
// SubscriptionStatus is an alias for stripe.SubscriptionStatus
type Subscripti... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/payments/payments_dummy.go | payments/payments_dummy.go | //go:build nopayments
package payments
// Available is a constant used to indicate that Stripe support is available.
// It can be disabled with the 'nopayments' build tag.
const Available = false
// SubscriptionStatus is a dummy type
type SubscriptionStatus string
// PriceRecurringInterval is dummy type
type PriceR... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/time.go | util/time.go | package util
import (
"errors"
"github.com/olebedev/when"
"regexp"
"strconv"
"strings"
"time"
)
var (
errInvalidDuration = errors.New("unable to parse duration")
durationStrRegex = regexp.MustCompile(`(?i)^(\d+)\s*(d|days?|h|hours?|m|mins?|minutes?|s|secs?|seconds?)$`)
)
const (
timestampFormat = "2006-01... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/time_test.go | util/time_test.go | package util
import (
"github.com/stretchr/testify/require"
"testing"
"time"
)
var (
// 2021-12-10 10:17:23 (Friday)
base = time.Date(2021, 12, 10, 10, 17, 23, 0, time.UTC)
)
func TestNextOccurrenceUTC_NextDate(t *testing.T) {
loc, err := time.LoadLocation("America/New_York")
require.Nil(t, err)
timeOfDay :... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/limit_test.go | util/limit_test.go | package util
import (
"bytes"
"github.com/stretchr/testify/require"
"testing"
"time"
)
func TestFixedLimiter_AllowValueReset(t *testing.T) {
l := NewFixedLimiter(10)
require.True(t, l.AllowN(5))
require.Equal(t, int64(5), l.Value())
require.True(t, l.AllowN(5))
require.Equal(t, int64(10), l.Value())
requi... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/timeout_writer.go | util/timeout_writer.go | package util
import (
"errors"
"io"
"time"
)
// ErrWriteTimeout is returned when a write timed out
var ErrWriteTimeout = errors.New("write operation failed due to timeout")
// TimeoutWriter wraps an io.Writer that will time out after the given timeout
type TimeoutWriter struct {
writer io.Writer
timeout time.D... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/gzip_handler_test.go | util/gzip_handler_test.go | package util
import (
"compress/gzip"
"github.com/stretchr/testify/require"
"io"
"net/http"
"net/http/httptest"
"testing"
)
func TestGzipHandler(t *testing.T) {
s := Gzip(http.FileServer(http.FS(testFs)))
rr := httptest.NewRecorder()
req, _ := http.NewRequest("GET", "/embedfs/test.txt", nil)
req.Header.Set... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/lookup_cache.go | util/lookup_cache.go | package util
import (
"sync"
"time"
)
// LookupCache is a single-value cache with a time-to-live (TTL). The cache has a lookup function
// to retrieve the value and stores it until TTL is reached.
//
// Example:
//
// lookup := func() (string, error) {
// r, _ := http.Get("...")
// s, _ := io.ReadAll(r.Body)
... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/content_type_writer_test.go | util/content_type_writer_test.go | package util
import (
"crypto/rand"
"github.com/stretchr/testify/require"
"net/http/httptest"
"testing"
)
func TestSniffWriter_WriteHTML(t *testing.T) {
rr := httptest.NewRecorder()
sw := NewContentTypeWriter(rr, "")
sw.Write([]byte("<script>alert('hi')</script>"))
require.Equal(t, "text/plain; charset=utf-8"... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/peek_test.go | util/peek_test.go | package util
import (
"github.com/stretchr/testify/require"
"io"
"strings"
"testing"
)
func TestPeak_LimitReached(t *testing.T) {
underlying := io.NopCloser(strings.NewReader("1234567890"))
peaked, err := Peek(underlying, 5)
if err != nil {
t.Fatal(err)
}
require.Equal(t, []byte("12345"), peaked.PeekedByte... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/lookup_cache_test.go | util/lookup_cache_test.go | package util
import (
"errors"
"github.com/stretchr/testify/require"
"testing"
"time"
)
func TestLookupCache_Success(t *testing.T) {
values, i := []string{"first", "second"}, 0
c := NewLookupCache[string](func() (string, error) {
time.Sleep(300 * time.Millisecond)
v := values[i]
i++
return v, nil
}, 50... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/embedfs_test.go | util/embedfs_test.go | package util
import (
"embed"
"github.com/stretchr/testify/require"
"net/http"
"net/http/httptest"
"testing"
"time"
)
var (
modTime = time.Now()
//go:embed embedfs
testFs embed.FS
testFsCached = &CachingEmbedFS{ModTime: modTime, FS: testFs}
)
func TestCachingEmbedFS(t *testing.T) {
s := http.FileSe... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/util.go | util/util.go | package util
import (
"bytes"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"io"
"math"
"math/rand"
"net/netip"
"os"
"regexp"
"strconv"
"strings"
"sync"
"time"
"github.com/gabriel-vasile/mimetype"
"golang.org/x/term"
"golang.org/x/time/rate"
)
const (
randomStringCharset = "abcdefghijk... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/limit.go | util/limit.go | package util
import (
"errors"
"golang.org/x/time/rate"
"io"
"sync"
"time"
)
// ErrLimitReached is the error returned by the Limiter and LimitWriter when the predefined limit has been reached
var ErrLimitReached = errors.New("limit reached")
// Limiter is an interface that implements a rate limiting mechanism, ... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/batching_queue.go | util/batching_queue.go | package util
import (
"sync"
"time"
)
// BatchingQueue is a queue that creates batches of the enqueued elements based on a
// max batch size and a batch timeout.
//
// Example:
//
// q := NewBatchingQueue[int](2, 500 * time.Millisecond)
// go func() {
// for batch := range q.Dequeue() {
// fmt.Println(batch)
... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/peek.go | util/peek.go | package util
import (
"bytes"
"errors"
"io"
"strings"
)
// PeekedReadCloser is a ReadCloser that allows peeking into a stream and buffering it in memory.
// It can be instantiated using the Peek function. After a stream has been peeked, it can still be fully
// read by reading the PeekedReadCloser. It first drain... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/gzip_handler.go | util/gzip_handler.go | package util
import (
"compress/gzip"
"io"
"net/http"
"strings"
"sync"
)
// Gzip is a HTTP middleware to transparently compress responses using gzip.
// Original code from https://gist.github.com/CJEnright/bc2d8b8dc0c1389a9feeddb110f822d7 (MIT)
func Gzip(next http.Handler) http.Handler {
return http.HandlerFunc... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/batching_queue_test.go | util/batching_queue_test.go | package util_test
import (
"github.com/stretchr/testify/require"
"heckel.io/ntfy/v2/util"
"math/rand"
"sync"
"testing"
"time"
)
func TestBatchingQueue_InfTimeout(t *testing.T) {
q := util.NewBatchingQueue[int](25, 1*time.Hour)
batches, total := make([][]int, 0), 0
var mu sync.Mutex
go func() {
for batch :... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/embedfs.go | util/embedfs.go | package util
import (
"embed"
"errors"
"io"
"io/fs"
"time"
)
// CachingEmbedFS is a wrapper around embed.FS that allows setting a ModTime, so that the
// default static file server can send 304s back. It can be used like this:
//
// var (
// //go:embed docs
// docsStaticFs embed.FS
// docsSt... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/content_type_writer.go | util/content_type_writer.go | package util
import (
"net/http"
"strings"
)
// ContentTypeWriter is an implementation of http.ResponseWriter that will detect the content type and set the
// Content-Type and (optionally) Content-Disposition headers accordingly.
//
// It will always set a Content-Type based on http.DetectContentType, but will neve... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/util_test.go | util/util_test.go | package util
import (
"errors"
"io"
"net/netip"
"os"
"path/filepath"
"strings"
"testing"
"time"
"golang.org/x/time/rate"
"github.com/stretchr/testify/require"
)
func TestRandomString(t *testing.T) {
s1 := RandomString(10)
s2 := RandomString(10)
s3 := RandomString(12)
require.Equal(t, 10, len(s1))
req... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/date_test.go | util/sprig/date_test.go | package sprig
import (
"testing"
"time"
)
func TestHtmlDate(t *testing.T) {
t.Skip()
tpl := `{{ htmlDate 0}}`
if err := runt(tpl, "1970-01-01"); err != nil {
t.Error(err)
}
}
func TestAgo(t *testing.T) {
tpl := "{{ ago .Time }}"
if err := runtv(tpl, "2m5s", map[string]any{"Time": time.Now().Add(-125 * time... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/strings_test.go | util/sprig/strings_test.go | package sprig
import (
"encoding/base32"
"encoding/base64"
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestSubstr(t *testing.T) {
tpl := `{{"fooo" | substr 0 3 }}`
if err := runt(tpl, "foo"); err != nil {
t.Error(err)
}
}
func TestSubstr_shorterString(t *testing.T) {
tpl := `{{"foo" | sub... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/crypto_test.go | util/sprig/crypto_test.go | package sprig
import (
"testing"
)
func TestSha512Sum(t *testing.T) {
tpl := `{{"abc" | sha512sum}}`
if err := runt(tpl, "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"); err != nil {
t.Error(err)
}
}
func TestSha256Sum(t *testi... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/regex_test.go | util/sprig/regex_test.go | package sprig
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestRegexMatch(t *testing.T) {
regex := "[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}"
assert.True(t, regexMatch(regex, "test@acme.com"))
assert.True(t, regexMatch(regex, "Test@Acme.Com"))
assert.False(t, regexMatch(regex, "test")... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/numeric_test.go | util/sprig/numeric_test.go | package sprig
import (
"fmt"
"github.com/stretchr/testify/assert"
"strconv"
"testing"
)
func TestUntil(t *testing.T) {
tests := map[string]string{
`{{range $i, $e := until 5}}{{$i}}{{$e}}{{end}}`: "0011223344",
`{{range $i, $e := until -5}}{{$i}}{{$e}} {{end}}`: "00 1-1 2-2 3-3 4-4 ",
}
for tpl, expect :... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/flow_control.go | util/sprig/flow_control.go | package sprig
import "errors"
// fail is a function that always returns an error with the given message.
func fail(msg string) (string, error) {
return "", errors.New(msg)
}
| go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/defaults.go | util/sprig/defaults.go | package sprig
import (
"bytes"
"encoding/json"
"reflect"
"strings"
)
// defaultValue checks whether `given` is set, and returns default if not set.
//
// This returns `d` if `given` appears not to be set, and `given` otherwise.
//
// For numeric types 0 is unset.
// For strings, maps, arrays, and slices, len() = ... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/url.go | util/sprig/url.go | package sprig
import (
"fmt"
"net/url"
"reflect"
)
func dictGetOrEmpty(dict map[string]any, key string) string {
value, ok := dict[key]
if !ok {
return ""
}
tp := reflect.TypeOf(value).Kind()
if tp != reflect.String {
panic(fmt.Sprintf("unable to parse %s key, must be of type string, but %s found", key, t... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/strings.go | util/sprig/strings.go | package sprig
import (
"encoding/base32"
"encoding/base64"
"fmt"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"reflect"
"strconv"
"strings"
)
// base64encode encodes a string to base64 using standard encoding.
//
// Parameters:
// - v: The string to encode
//
// Returns:
// - string: The base64 ... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/list_test.go | util/sprig/list_test.go | package sprig
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestTuple(t *testing.T) {
tpl := `{{$t := tuple 1 "a" "foo"}}{{index $t 2}}{{index $t 0 }}{{index $t 1}}`
if err := runt(tpl, "foo1a"); err != nil {
t.Error(err)
}
}
func TestList(t *testing.T) {
tpl := `{{$t := list 1 "... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/date.go | util/sprig/date.go | package sprig
import (
"math"
"strconv"
"time"
)
// date formats a date according to the provided format string.
//
// Parameters:
// - fmt: A Go time format string (e.g., "2006-01-02 15:04:05")
// - date: Can be a time.Time, *time.Time, or int/int32/int64 (seconds since UNIX epoch)
//
// If date is not one of... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/defaults_test.go | util/sprig/defaults_test.go | package sprig
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestDefault(t *testing.T) {
tpl := `{{"" | default "foo"}}`
if err := runt(tpl, "foo"); err != nil {
t.Error(err)
}
tpl = `{{default "foo" 234}}`
if err := runt(tpl, "234"); err != nil {
t.Error(err)
}
tpl = `{{default "foo" 2.... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/example_test.go | util/sprig/example_test.go | package sprig
import (
"fmt"
"os"
"text/template"
)
func Example() {
// Set up variables and template.
vars := map[string]any{"Name": " John Jacob Jingleheimer Schmidt "}
tpl := `Hello {{.Name | trim | lower}}`
// Get the Sprig function map.
fmap := TxtFuncMap()
t := template.Must(template.New("test").Func... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
binwiederhier/ntfy | https://github.com/binwiederhier/ntfy/blob/e18d64933fdfad2710ad8a930e1f880c2714cb52/util/sprig/list.go | util/sprig/list.go | package sprig
import (
"fmt"
"math"
"reflect"
"sort"
)
// Reflection is used in these functions so that slices and arrays of strings,
// ints, and other types not implementing []any can be worked with.
// For example, this is useful if you need to work on the output of regexs.
// list creates a new list (slice) ... | go | Apache-2.0 | e18d64933fdfad2710ad8a930e1f880c2714cb52 | 2026-01-07T08:37:03.915928Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.