mirror of
https://github.com/cmur2/dyndnsd.git
synced 2025-08-08 08:33:56 +02:00
Compare commits
44 Commits
Author | SHA1 | Date | |
---|---|---|---|
6fd26a4908 | |||
![]() |
3af42e4c20 | ||
![]() |
aae2a633c5 | ||
![]() |
c7aed4353a | ||
c335a96e12 | |||
c2ed69da6d | |||
![]() |
b2d421154e | ||
5444782ead | |||
1c1bcd253a | |||
23c09f722c | |||
e29b451de4 | |||
d89c1c6091 | |||
2a7ea2bb8f | |||
94823dc041 | |||
![]() |
4c25b9b66b | ||
fb42c57ff1 | |||
![]() |
268e18f2e5 | ||
e8e9e0cb71 | |||
![]() |
8819d6058a | ||
dc325d686e | |||
![]() |
f0aeea96d4 | ||
ff136f7b16 | |||
![]() |
377a6ac179 | ||
![]() |
2cc45e5c0f | ||
19683672d1 | |||
4c1fb5783d | |||
d8f5618006 | |||
e063b6cb4c | |||
![]() |
f64bcc0780 | ||
![]() |
568ea08543 | ||
![]() |
5c16524788 | ||
d1c1a98e47 | |||
d62bf71820 | |||
156557c6d7 | |||
fd1d58abd6 | |||
![]() |
fc4d731434 | ||
![]() |
8b42a916d0 | ||
![]() |
e899488fa9 | ||
6ed0799f49 | |||
5b332d8f57 | |||
0de5078d9d | |||
![]() |
72c8dda7dd | ||
e36b210f66 | |||
fcc3f12284 |
4
.github/workflows/cd.yml
vendored
4
.github/workflows/cd.yml
vendored
@@ -10,10 +10,10 @@ jobs:
|
|||||||
release-dockerimage:
|
release-dockerimage:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v2
|
||||||
- name: Extract dyndnsd version from tag name
|
- name: Extract dyndnsd version from tag name
|
||||||
run: |
|
run: |
|
||||||
echo ::set-env name=DYNDNSD_VERSION::${GITHUB_REF#refs/*/v}
|
echo "DYNDNSD_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
|
||||||
# https://github.com/marketplace/actions/build-and-push-docker-images
|
# https://github.com/marketplace/actions/build-and-push-docker-images
|
||||||
- name: Build and push Docker image for dyndnsd ${{ env.DYNDNSD_VERSION }}
|
- name: Build and push Docker image for dyndnsd ${{ env.DYNDNSD_VERSION }}
|
||||||
uses: docker/build-push-action@v1
|
uses: docker/build-push-action@v1
|
||||||
|
29
.github/workflows/ci.yml
vendored
Normal file
29
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
---
|
||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '35 4 * * 4' # weekly on thursday morning
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
ruby-version:
|
||||||
|
- '3.0'
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up Ruby ${{ matrix.ruby-version }}
|
||||||
|
uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: ${{ matrix.ruby-version }}
|
||||||
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
||||||
|
- name: Lint and Test
|
||||||
|
run: |
|
||||||
|
bundle exec rake ci
|
19
.github/workflows/dockerhub.yml
vendored
Normal file
19
.github/workflows/dockerhub.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
name: dockerhub
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '7 4 * * 4' # weekly on thursday morning
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pull-released-dockerimages:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Avoid stale tags by pulling
|
||||||
|
run: |
|
||||||
|
ALL_IMAGES="$(curl -s https://hub.docker.com/v2/repositories/cmur2/dyndnsd/tags?page_size=1000 | jq -r '.results[].name | "cmur2/dyndnsd:" + .' | grep -e 'cmur2/dyndnsd:v')"
|
||||||
|
for image in $ALL_IMAGES; do
|
||||||
|
echo "Pulling $image to avoid staleness..."
|
||||||
|
docker pull "$image"
|
||||||
|
done
|
9
.github/workflows/vulnscan.yml
vendored
9
.github/workflows/vulnscan.yml
vendored
@@ -17,22 +17,25 @@ jobs:
|
|||||||
- name: Install Trivy
|
- name: Install Trivy
|
||||||
run: |
|
run: |
|
||||||
mkdir -p $GITHUB_WORKSPACE/bin
|
mkdir -p $GITHUB_WORKSPACE/bin
|
||||||
echo "::add-path::$GITHUB_WORKSPACE/bin"
|
echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH"
|
||||||
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sh -s -- -b $GITHUB_WORKSPACE/bin
|
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sh -s -- -b $GITHUB_WORKSPACE/bin
|
||||||
- name: Download Trivy DB
|
- name: Download Trivy DB
|
||||||
run: |
|
run: |
|
||||||
trivy image --download-db-only
|
trivy image --download-db-only
|
||||||
- name: Scan vulnerabilities using Trivy
|
- name: Scan vulnerabilities using Trivy
|
||||||
|
env:
|
||||||
|
TRIVY_SKIP_DIRS: 'usr/lib/ruby/gems/2.7.0/gems/jaeger-client-0.10.0/crossdock,usr/lib/ruby/gems/2.7.0/gems/jaeger-client-1.0.0/crossdock,usr/lib/ruby/gems/2.7.0/gems/jaeger-client-1.1.0/crossdock'
|
||||||
run: |
|
run: |
|
||||||
trivy --version
|
trivy --version
|
||||||
|
|
||||||
ALL_IMAGES="$(curl -s https://hub.docker.com/v2/repositories/cmur2/dyndnsd/tags?page_size=1000 | jq -r '.results[].name | "cmur2/dyndnsd:" + .' | grep -e 'cmur2/dyndnsd:v' | sort -r)"
|
# semver sorting as per https://stackoverflow.com/a/40391207/2148786
|
||||||
|
ALL_IMAGES="$(curl -s https://hub.docker.com/v2/repositories/cmur2/dyndnsd/tags?page_size=1000 | jq -r '.results[].name | "cmur2/dyndnsd:" + .' | grep -e 'cmur2/dyndnsd:v' | sed '/-/!{s/$/_/}' | sort -r -V | sed 's/_$//')"
|
||||||
EXIT_CODE=0
|
EXIT_CODE=0
|
||||||
set -e
|
set -e
|
||||||
for major_version in $(seq 1 10); do
|
for major_version in $(seq 1 10); do
|
||||||
for image in $ALL_IMAGES; do
|
for image in $ALL_IMAGES; do
|
||||||
if [[ "$image" = cmur2/dyndnsd:v$major_version.* ]]; then
|
if [[ "$image" = cmur2/dyndnsd:v$major_version.* ]]; then
|
||||||
echo -n "\nScanning newest patch release $image of major v$major_version...\n"
|
echo -e "\nScanning newest patch release $image of major v$major_version...\n"
|
||||||
if ! trivy image --skip-update --exit-code 1 "$image"; then
|
if ! trivy image --skip-update --exit-code 1 "$image"; then
|
||||||
EXIT_CODE=1
|
EXIT_CODE=1
|
||||||
fi
|
fi
|
||||||
|
12
.rubocop.yml
12
.rubocop.yml
@@ -1,5 +1,9 @@
|
|||||||
|
require:
|
||||||
|
- rubocop-rake
|
||||||
|
- rubocop-rspec
|
||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
TargetRubyVersion: '2.5'
|
TargetRubyVersion: '3.0'
|
||||||
NewCops: enable
|
NewCops: enable
|
||||||
|
|
||||||
Layout/EmptyLineAfterGuardClause:
|
Layout/EmptyLineAfterGuardClause:
|
||||||
@@ -86,3 +90,9 @@ Style/SymbolArray:
|
|||||||
|
|
||||||
Style/TrailingCommaInArrayLiteral:
|
Style/TrailingCommaInArrayLiteral:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
RSpec/ExampleLength:
|
||||||
|
Max: 20
|
||||||
|
|
||||||
|
RSpec/MultipleExpectations:
|
||||||
|
Max: 20
|
||||||
|
10
.travis.yml
10
.travis.yml
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
os: linux
|
|
||||||
language: ruby
|
|
||||||
rvm:
|
|
||||||
- 2.7
|
|
||||||
- 2.6
|
|
||||||
- 2.5
|
|
||||||
|
|
||||||
script:
|
|
||||||
- bundle exec rake travis
|
|
31
CHANGELOG.md
31
CHANGELOG.md
@@ -1,5 +1,36 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 3.3.0 (January 18, 2021)
|
||||||
|
|
||||||
|
OTHER:
|
||||||
|
|
||||||
|
- update base of Docker image to Alpine 3.13
|
||||||
|
|
||||||
|
## 3.2.0 (January 14, 2021)
|
||||||
|
|
||||||
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
- Add Ruby 3.0 support
|
||||||
|
|
||||||
|
## 3.1.3 (December 20, 2020)
|
||||||
|
|
||||||
|
OTHER:
|
||||||
|
|
||||||
|
- fix Docker image release process in Github Actions CI, 3.1.2 was not released as a Docker image
|
||||||
|
|
||||||
|
## 3.1.2 (December 20, 2020)
|
||||||
|
|
||||||
|
OTHER:
|
||||||
|
|
||||||
|
- fixes vulnerabilities in Docker image by using updated Alpine base image
|
||||||
|
- start using Github Actions CI for tests and drop Travis CI
|
||||||
|
|
||||||
|
## 3.1.1 (October 3, 2020)
|
||||||
|
|
||||||
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
- Use webrick gem which contains fixes against [CVE-2020-25613](https://www.ruby-lang.org/en/news/2020/09/29/http-request-smuggling-cve-2020-25613/)
|
||||||
|
|
||||||
## 3.1.0 (August 19, 2020)
|
## 3.1.0 (August 19, 2020)
|
||||||
|
|
||||||
IMPROVEMENTS:
|
IMPROVEMENTS:
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
# dyndnsd.rb
|
# dyndnsd.rb
|
||||||
|
|
||||||
[](https://travis-ci.org/cmur2/dyndnsd) [](https://depfu.com/github/cmur2/dyndnsd)
|
 [](https://depfu.com/github/cmur2/dyndnsd)
|
||||||
|
|
||||||
A small, lightweight and extensible DynDNS server written with Ruby and Rack.
|
A small, lightweight and extensible DynDNS server written with Ruby and Rack.
|
||||||
|
|
||||||
|
36
Rakefile
36
Rakefile
@@ -9,16 +9,36 @@ RSpec::Core::RakeTask.new(:spec)
|
|||||||
RuboCop::RakeTask.new
|
RuboCop::RakeTask.new
|
||||||
Bundler::Audit::Task.new
|
Bundler::Audit::Task.new
|
||||||
|
|
||||||
desc 'Should be run by developer once to prepare initial solargraph usage (fill caches etc.)'
|
|
||||||
task :'solargraph:init' do
|
|
||||||
sh 'solargraph download-core'
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'Run experimental solargraph type checker'
|
desc 'Run experimental solargraph type checker'
|
||||||
task :'solargraph:tc' do
|
task :solargraph do
|
||||||
sh 'solargraph typecheck'
|
sh 'solargraph typecheck'
|
||||||
end
|
end
|
||||||
|
|
||||||
task default: [:rubocop, :spec, 'bundle:audit']
|
namespace :solargraph do
|
||||||
|
desc 'Should be run by developer once to prepare initial solargraph usage (fill caches etc.)'
|
||||||
|
task :init do
|
||||||
|
sh 'solargraph download-core'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
task travis: [:default, :'solargraph:init', :'solargraph:tc']
|
desc 'Run hadolint for Dockerfile linting'
|
||||||
|
task :hadolint do
|
||||||
|
sh 'docker run --rm -i hadolint/hadolint:v1.18.0 hadolint --ignore DL3018 - < docker/Dockerfile'
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Run experimental steep type checker'
|
||||||
|
task :steep do
|
||||||
|
sh 'steep check'
|
||||||
|
end
|
||||||
|
|
||||||
|
namespace :steep do
|
||||||
|
desc 'Output coverage stats from steep'
|
||||||
|
task :stats do
|
||||||
|
sh 'steep stats --log-level=fatal | awk -F\',\' \'{ printf "%-50s %-9s %-12s %-14s %-10s\n", $2, $3, $4, $5, $7 }\''
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
task default: [:rubocop, :spec, 'bundle:audit', :solargraph, :steep]
|
||||||
|
|
||||||
|
desc 'Run all tasks desired for CI'
|
||||||
|
task ci: ['solargraph:init', :default, :hadolint]
|
||||||
|
11
Steepfile
Normal file
11
Steepfile
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
target :lib do
|
||||||
|
signature 'sig'
|
||||||
|
|
||||||
|
check 'lib'
|
||||||
|
ignore 'lib/dyndnsd/updater/zone_transfer_server.rb'
|
||||||
|
|
||||||
|
library 'date'
|
||||||
|
library 'forwardable'
|
||||||
|
end
|
@@ -1,4 +1,4 @@
|
|||||||
FROM alpine:3.12
|
FROM alpine:3.13
|
||||||
|
|
||||||
EXPOSE 5353 8080
|
EXPOSE 5353 8080
|
||||||
|
|
||||||
|
@@ -25,20 +25,24 @@ Gem::Specification.new do |s|
|
|||||||
s.executables = ['dyndnsd']
|
s.executables = ['dyndnsd']
|
||||||
s.extra_rdoc_files = Dir['README.md', 'CHANGELOG.md', 'LICENSE']
|
s.extra_rdoc_files = Dir['README.md', 'CHANGELOG.md', 'LICENSE']
|
||||||
|
|
||||||
s.required_ruby_version = '>= 2.5'
|
s.required_ruby_version = '>= 3.0'
|
||||||
|
|
||||||
s.add_runtime_dependency 'async-dns', '~> 1.2.0'
|
s.add_runtime_dependency 'async-dns', '~> 1.2.0'
|
||||||
s.add_runtime_dependency 'jaeger-client', '~> 1.0.0'
|
s.add_runtime_dependency 'jaeger-client', '~> 1.1.0'
|
||||||
s.add_runtime_dependency 'metriks'
|
s.add_runtime_dependency 'metriks'
|
||||||
s.add_runtime_dependency 'opentracing', '~> 0.5.0'
|
s.add_runtime_dependency 'opentracing', '~> 0.5.0'
|
||||||
s.add_runtime_dependency 'rack', '~> 2.0'
|
s.add_runtime_dependency 'rack', '~> 2.0'
|
||||||
s.add_runtime_dependency 'rack-tracer', '~> 0.9.0'
|
s.add_runtime_dependency 'rack-tracer', '~> 0.9.0'
|
||||||
|
s.add_runtime_dependency 'webrick', '>= 1.6.1'
|
||||||
|
|
||||||
s.add_development_dependency 'bundler'
|
s.add_development_dependency 'bundler'
|
||||||
s.add_development_dependency 'bundler-audit', '~> 0.7.0'
|
s.add_development_dependency 'bundler-audit', '~> 0.7.0'
|
||||||
s.add_development_dependency 'rack-test'
|
s.add_development_dependency 'rack-test'
|
||||||
s.add_development_dependency 'rake'
|
s.add_development_dependency 'rake'
|
||||||
s.add_development_dependency 'rspec'
|
s.add_development_dependency 'rspec'
|
||||||
s.add_development_dependency 'rubocop', '~> 0.89.0'
|
s.add_development_dependency 'rubocop', '~> 1.7.0'
|
||||||
s.add_development_dependency 'solargraph'
|
s.add_development_dependency 'rubocop-rake', '~> 0.5.1'
|
||||||
|
s.add_development_dependency 'rubocop-rspec', '~> 2.1.0'
|
||||||
|
s.add_development_dependency 'solargraph', '~> 0.40.0'
|
||||||
|
s.add_development_dependency 'steep', '~> 0.39.0'
|
||||||
end
|
end
|
||||||
|
@@ -276,7 +276,7 @@ module Dyndnsd
|
|||||||
reporter = Metriks::Reporter::Graphite.new(host, port, options)
|
reporter = Metriks::Reporter::Graphite.new(host, port, options)
|
||||||
reporter.start
|
reporter.start
|
||||||
elsif config['textfile']
|
elsif config['textfile']
|
||||||
file = config['textfile']['file'] || '/tmp/dyndnsd-metrics.prom'
|
file = (config['textfile']['file'] || '/tmp/dyndnsd-metrics.prom').to_s
|
||||||
options = {}
|
options = {}
|
||||||
options[:prefix] = config['textfile']['prefix'] if config['textfile']['prefix']
|
options[:prefix] = config['textfile']['prefix'] if config['textfile']['prefix']
|
||||||
reporter = Dyndnsd::TextfileReporter.new(file, options)
|
reporter = Dyndnsd::TextfileReporter.new(file, options)
|
||||||
|
@@ -60,7 +60,7 @@ module Dyndnsd
|
|||||||
message: e.message,
|
message: e.message,
|
||||||
stack: e.backtrace&.join("\n") || ''
|
stack: e.backtrace&.join("\n") || ''
|
||||||
)
|
)
|
||||||
raise
|
raise e
|
||||||
ensure
|
ensure
|
||||||
scope.close
|
scope.close
|
||||||
end
|
end
|
||||||
|
@@ -33,6 +33,7 @@ module Dyndnsd
|
|||||||
when 422
|
when 422
|
||||||
error_response_map[headers['X-DynDNS-Response']]
|
error_response_map[headers['X-DynDNS-Response']]
|
||||||
end
|
end
|
||||||
|
# TODO: possible nil response!
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param status_code [Integer]
|
# @param status_code [Integer]
|
||||||
@@ -46,6 +47,7 @@ module Dyndnsd
|
|||||||
when 401
|
when 401
|
||||||
[status_code, headers, ['badauth']]
|
[status_code, headers, ['badauth']]
|
||||||
end
|
end
|
||||||
|
# TODO: possible nil response!
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param changes [Array<Symbol>]
|
# @param changes [Array<Symbol>]
|
||||||
|
@@ -33,6 +33,7 @@ module Dyndnsd
|
|||||||
when 422
|
when 422
|
||||||
error_response_map[headers['X-DynDNS-Response']]
|
error_response_map[headers['X-DynDNS-Response']]
|
||||||
end
|
end
|
||||||
|
# TODO: possible nil response!
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param status_code [Integer]
|
# @param status_code [Integer]
|
||||||
@@ -46,6 +47,7 @@ module Dyndnsd
|
|||||||
when 401
|
when 401
|
||||||
[status_code, headers, ['Unauthorized']]
|
[status_code, headers, ['Unauthorized']]
|
||||||
end
|
end
|
||||||
|
# TODO: possible nil response!
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param changes [Array<Symbol>]
|
# @param changes [Array<Symbol>]
|
||||||
|
@@ -18,7 +18,7 @@ module Dyndnsd
|
|||||||
|
|
||||||
@registry = options[:registry] || Metriks::Registry.default
|
@registry = options[:registry] || Metriks::Registry.default
|
||||||
@interval = options[:interval] || 60
|
@interval = options[:interval] || 60
|
||||||
@on_error = options[:on_error] || proc { |ex| }
|
@on_error = options[:on_error] || proc { |ex| } # default: ignore errors
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [void]
|
# @return [void]
|
||||||
@@ -91,7 +91,7 @@ module Dyndnsd
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# @param file [String]
|
# @param file [File]
|
||||||
# @param base_name [String]
|
# @param base_name [String]
|
||||||
# @param metric [Object]
|
# @param metric [Object]
|
||||||
# @param keys [Array<Symbol>]
|
# @param keys [Array<Symbol>]
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Dyndnsd
|
module Dyndnsd
|
||||||
VERSION = '3.1.0'
|
VERSION = '3.3.0'
|
||||||
end
|
end
|
||||||
|
69
sig/dyndnsd.rbs
Normal file
69
sig/dyndnsd.rbs
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
module Dyndnsd
|
||||||
|
type config = Hash[String, untyped]
|
||||||
|
type env = Hash[String, String]
|
||||||
|
type headers = Hash[String, String]
|
||||||
|
type response = Array[int | Hash[string, string] | Array[string]]
|
||||||
|
|
||||||
|
interface _App
|
||||||
|
def call: (env env) -> response
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
# @return [Logger]
|
||||||
|
def self.logger: () -> untyped
|
||||||
|
|
||||||
|
# @param logger [Logger]
|
||||||
|
# @return [Logger]
|
||||||
|
def self.logger=: (untyped logger) -> untyped
|
||||||
|
|
||||||
|
class LogFormatter
|
||||||
|
# @param lvl [Object]
|
||||||
|
# @param _time [DateTime]
|
||||||
|
# @param _progname [String]
|
||||||
|
# @param msg [Object]
|
||||||
|
# @return [String]
|
||||||
|
def call: (untyped lvl, DateTime _time, String _progname, untyped msg) -> String
|
||||||
|
end
|
||||||
|
|
||||||
|
class Daemon
|
||||||
|
# @param config [Hash{String => Object}]
|
||||||
|
# @param db [Dyndnsd::Database]
|
||||||
|
# @param updater [#update]
|
||||||
|
def initialize: (untyped config, untyped db, untyped updater) -> void
|
||||||
|
|
||||||
|
# @param username [String]
|
||||||
|
# @param password [String]
|
||||||
|
# @return [Boolean]
|
||||||
|
def authorized?: (String username, String password) -> bool
|
||||||
|
|
||||||
|
def call: (env env) -> response
|
||||||
|
|
||||||
|
def self.run!: () -> void
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# @param params [Hash{String => String}]
|
||||||
|
# @return [Array<String>]
|
||||||
|
def extract_v4_and_v6_address: (untyped params) -> (::Array[untyped] | untyped)
|
||||||
|
|
||||||
|
# @param env [Hash{String => String}]
|
||||||
|
# @param params [Hash{String => String}]
|
||||||
|
# @return [Array<String>]
|
||||||
|
def extract_myips: (untyped env, untyped params) -> (untyped | ::Array[untyped])
|
||||||
|
|
||||||
|
# @param hostnames [String]
|
||||||
|
# @param myips [Array<String>]
|
||||||
|
# @return [Array<Symbol>]
|
||||||
|
def process_changes: (untyped hostnames, untyped myips) -> untyped
|
||||||
|
|
||||||
|
def update_db: () -> void
|
||||||
|
|
||||||
|
def handle_dyndns_request: (env env) -> response
|
||||||
|
|
||||||
|
def self.setup_logger: (config config) -> void
|
||||||
|
def self.setup_traps: () -> void
|
||||||
|
def self.setup_monitoring: (config config) -> void
|
||||||
|
def self.setup_tracing: (config config) -> void
|
||||||
|
def self.setup_rack: (config config) -> void
|
||||||
|
end
|
||||||
|
end
|
21
sig/dyndnsd/database.rbs
Normal file
21
sig/dyndnsd/database.rbs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
module Dyndnsd
|
||||||
|
class Database
|
||||||
|
extend Forwardable
|
||||||
|
|
||||||
|
def initialize: (string db_file) -> void
|
||||||
|
|
||||||
|
def load: () -> void
|
||||||
|
|
||||||
|
def save: () -> void
|
||||||
|
|
||||||
|
def changed?: () -> bool
|
||||||
|
|
||||||
|
def []: (string key) -> untyped
|
||||||
|
|
||||||
|
def []=: (string key, untyped value) -> void
|
||||||
|
|
||||||
|
def each: () { (string key, untyped value) -> void } -> void
|
||||||
|
|
||||||
|
def has_key?: (string key) -> bool
|
||||||
|
end
|
||||||
|
end
|
9
sig/dyndnsd/generator/bind.rbs
Normal file
9
sig/dyndnsd/generator/bind.rbs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
module Dyndnsd
|
||||||
|
module Generator
|
||||||
|
class Bind
|
||||||
|
def initialize: (String domain, Hash[String, untyped] updater_params) -> void
|
||||||
|
|
||||||
|
def generate: (Dyndnsd::Database db) -> string
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
32
sig/dyndnsd/helper.rbs
Normal file
32
sig/dyndnsd/helper.rbs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
module Dyndnsd
|
||||||
|
type users = Hash[String, Hash[String, String]]
|
||||||
|
type hosts = Hash[String, Array[String]]
|
||||||
|
|
||||||
|
class Helper
|
||||||
|
# @param hostname [String]
|
||||||
|
# @param domain [String]
|
||||||
|
# @return [Boolean]
|
||||||
|
def self.fqdn_valid?: (String hostname, String domain) -> bool
|
||||||
|
|
||||||
|
# @param ip [String]
|
||||||
|
# @return [Boolean]
|
||||||
|
def self.ip_valid?: (String ip) -> bool
|
||||||
|
|
||||||
|
# @param username [String]
|
||||||
|
# @param password [String]
|
||||||
|
# @param users [Hash]
|
||||||
|
# @return [Boolean]
|
||||||
|
def self.user_allowed?: (String username, String password, users users) -> bool
|
||||||
|
|
||||||
|
# @param hostname [String]
|
||||||
|
# @param myips [Array]
|
||||||
|
# @param hosts [Hash]
|
||||||
|
# @return [Boolean]
|
||||||
|
def self.changed?: (String hostname, Array[String] myips, hosts hosts) -> bool
|
||||||
|
|
||||||
|
# @param operation [String]
|
||||||
|
# @param block [Proc]
|
||||||
|
# @return [void]
|
||||||
|
def self.span: (String operation) { (untyped) -> untyped } -> untyped
|
||||||
|
end
|
||||||
|
end
|
19
sig/dyndnsd/responder/dyndns_style.rbs
Normal file
19
sig/dyndnsd/responder/dyndns_style.rbs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
module Dyndnsd
|
||||||
|
module Responder
|
||||||
|
class DynDNSStyle
|
||||||
|
def initialize: (_App app) -> void
|
||||||
|
|
||||||
|
def call: (env env) -> response?
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def decorate_dyndnsd_response: (int status_code, headers headers, Array[untyped] body) -> response?
|
||||||
|
|
||||||
|
def decorate_other_response: (int status_code, headers headers, Array[untyped] _body) -> response?
|
||||||
|
|
||||||
|
def get_success_body: (Array[Symbol] changes, Array[string] myips) -> string
|
||||||
|
|
||||||
|
def error_response_map: () -> Hash[string, response]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
19
sig/dyndnsd/responder/rest_style.rbs
Normal file
19
sig/dyndnsd/responder/rest_style.rbs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
module Dyndnsd
|
||||||
|
module Responder
|
||||||
|
class RestStyle
|
||||||
|
def initialize: (_App app) -> void
|
||||||
|
|
||||||
|
def call: (env env) -> response?
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def decorate_dyndnsd_response: (int status_code, headers headers, Array[untyped] body) -> response?
|
||||||
|
|
||||||
|
def decorate_other_response: (int status_code, headers headers, Array[untyped] _body) -> response?
|
||||||
|
|
||||||
|
def get_success_body: (Array[Symbol] changes, Array[string] myips) -> string
|
||||||
|
|
||||||
|
def error_response_map: () -> Hash[string, response]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
17
sig/dyndnsd/textfile_reporter.rbs
Normal file
17
sig/dyndnsd/textfile_reporter.rbs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
module Dyndnsd
|
||||||
|
class TextfileReporter
|
||||||
|
attr_reader file: String
|
||||||
|
|
||||||
|
def initialize: (String file, ?Hash[Symbol, untyped] options) -> void
|
||||||
|
|
||||||
|
def start: () -> void
|
||||||
|
|
||||||
|
def stop: () -> void
|
||||||
|
|
||||||
|
def restart: () -> void
|
||||||
|
|
||||||
|
def write: () -> void
|
||||||
|
|
||||||
|
def write_metric: (File file, String base_name, untyped metric, Array[Symbol] keys, Array[Symbol] snapshot_keys) -> void
|
||||||
|
end
|
||||||
|
end
|
9
sig/dyndnsd/updater/command_with_bind_zone.rbs
Normal file
9
sig/dyndnsd/updater/command_with_bind_zone.rbs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
module Dyndnsd
|
||||||
|
module Updater
|
||||||
|
class CommandWithBindZone
|
||||||
|
def initialize: (String domain, Hash[String, untyped] updater_params) -> void
|
||||||
|
|
||||||
|
def update: (Dyndnsd::Database db) -> void
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
39
sig/dyndnsd/updater/zone_transfer_server.rbs
Normal file
39
sig/dyndnsd/updater/zone_transfer_server.rbs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
module Dyndnsd
|
||||||
|
module Updater
|
||||||
|
class ZoneTransferServer
|
||||||
|
DEFAULT_SERVER_LISTENS: Array[String]
|
||||||
|
|
||||||
|
def initialize: (String domain, Hash[String, untyped] updater_params) -> void
|
||||||
|
|
||||||
|
def update: (Dyndnsd::Database db) -> void
|
||||||
|
|
||||||
|
# converts into suitable parameter form for Async::DNS::Resolver or Async::DNS::Server
|
||||||
|
#
|
||||||
|
# @param endpoint_list [Array<String>]
|
||||||
|
# @return [Array{Array{Object}}]
|
||||||
|
def self.parse_endpoints: (Array[String] endpoint_list) -> Array[Array[untyped]]
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# creates correct Resolv::DNS::Resource object for IP address type
|
||||||
|
#
|
||||||
|
# @param ip_string [String]
|
||||||
|
# @return [Resolv::DNS::Resource::IN::A,Resolv::DNS::Resource::IN::AAAA]
|
||||||
|
def create_addr_rr_for_ip: (String ip_string) -> untyped
|
||||||
|
|
||||||
|
def send_dns_notify: () -> void
|
||||||
|
end
|
||||||
|
|
||||||
|
class ZoneTransferServerHelper #< Async::DNS::Server
|
||||||
|
attr_accessor axfr_rrs: untyped
|
||||||
|
|
||||||
|
def initialize: (untyped endpoints, String domain) -> void
|
||||||
|
|
||||||
|
# @param name [String]
|
||||||
|
# @param resource_class [Resolv::DNS::Resource]
|
||||||
|
# Since solargraph cannot parse this: param transaction [Async::DNS::Transaction]
|
||||||
|
# @return [void]
|
||||||
|
def process: (String name, untyped resource_class, untyped transaction) -> void
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
3
sig/dyndnsd/version.rbs
Normal file
3
sig/dyndnsd/version.rbs
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module Dyndnsd
|
||||||
|
VERSION: ::String
|
||||||
|
end
|
@@ -1,6 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require_relative 'spec_helper'
|
require_relative '../spec_helper'
|
||||||
|
|
||||||
describe Dyndnsd::Daemon do
|
describe Dyndnsd::Daemon do
|
||||||
include Rack::Test::Methods
|
include Rack::Test::Methods
|
Reference in New Issue
Block a user