mirror of
https://github.com/cupcakearmy/docker-ddns-cloudflare.git
synced 2024-12-21 23:36:24 +00:00
commit
fb7416dbec
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
||||
ip.log
|
||||
dist
|
||||
node_modules
|
||||
.vscode
|
||||
|
@ -2,6 +2,7 @@
|
||||
TOKEn=myapitoken
|
||||
ZONE=example.org
|
||||
DNS_RECORD=some.example.org
|
||||
PROXIED=false
|
||||
|
||||
# Optional
|
||||
#CRON=* * * * *
|
||||
|
10
CHANGELOG.md
10
CHANGELOG.md
@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.2.1] - 2022-05-14
|
||||
|
||||
### Added
|
||||
|
||||
- Support for `proxied` parameter thanks to @borisbm.
|
||||
|
||||
### Security
|
||||
|
||||
- Updated dependencies.
|
||||
|
||||
## [1.2.0] - 2022-02-07
|
||||
|
||||
### Added
|
||||
|
@ -26,6 +26,7 @@ KEY=Global_API_Key
|
||||
|
||||
ZONE=example.org
|
||||
DNS_RECORD=some.example.org
|
||||
PROXIED=false
|
||||
```
|
||||
|
||||
3. Run the container
|
||||
@ -54,6 +55,7 @@ docker-compose up -d
|
||||
| `TOKEN` | API Token that can be used instead of `EMAIL` & `KEY`. | |
|
||||
| `ZONE` | Cloudflare zone where your domain is. | |
|
||||
| `DNS_RECORD` | The actual DNS record that should be updated. | |
|
||||
| `PROXIED` | Whether the record is proxied by CloudFlare or not. | |
|
||||
| `CRON` | Frequency of updates. | \*/5 \* \* \* \* |
|
||||
| `RESOLVER` | The endpoint used to determine your public ip. | https://api.ipify.org/ |
|
||||
|
||||
|
10
package.json
10
package.json
@ -6,16 +6,16 @@
|
||||
"build": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.25.0",
|
||||
"axios": "^0.27.2",
|
||||
"cloudflare": "^2.9.1",
|
||||
"cron": "^1.8.2",
|
||||
"dotenv": "^16.0.0",
|
||||
"winston": "^3.5.1"
|
||||
"dotenv": "^16.0.1",
|
||||
"winston": "^3.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cloudflare": "^2.7.7",
|
||||
"@types/cloudflare": "^2.7.8",
|
||||
"@types/cron": "^1.7.3",
|
||||
"ts-node-dev": "^1.1.8",
|
||||
"typescript": "^4.5.5"
|
||||
"typescript": "^4.6.4"
|
||||
}
|
||||
}
|
||||
|
209
pnpm-lock.yaml
generated
209
pnpm-lock.yaml
generated
@ -1,53 +1,69 @@
|
||||
lockfileVersion: 5.3
|
||||
|
||||
specifiers:
|
||||
'@types/cloudflare': ^2.7.7
|
||||
'@types/cloudflare': ^2.7.8
|
||||
'@types/cron': ^1.7.3
|
||||
axios: ^0.25.0
|
||||
axios: ^0.27.2
|
||||
cloudflare: ^2.9.1
|
||||
cron: ^1.8.2
|
||||
dotenv: ^16.0.0
|
||||
dotenv: ^16.0.1
|
||||
ts-node-dev: ^1.1.8
|
||||
typescript: ^4.5.5
|
||||
winston: ^3.5.1
|
||||
typescript: ^4.6.4
|
||||
winston: ^3.7.2
|
||||
|
||||
dependencies:
|
||||
axios: 0.25.0
|
||||
axios: 0.27.2
|
||||
cloudflare: 2.9.1
|
||||
cron: 1.8.2
|
||||
dotenv: 16.0.0
|
||||
winston: 3.5.1
|
||||
dotenv: 16.0.1
|
||||
winston: 3.7.2
|
||||
|
||||
devDependencies:
|
||||
'@types/cloudflare': 2.7.7
|
||||
'@types/cloudflare': 2.7.8
|
||||
'@types/cron': 1.7.3
|
||||
ts-node-dev: 1.1.8_typescript@4.5.5
|
||||
typescript: 4.5.5
|
||||
ts-node-dev: 1.1.8_typescript@4.6.4
|
||||
typescript: 4.6.4
|
||||
|
||||
packages:
|
||||
|
||||
/@dabh/diagnostics/2.0.2:
|
||||
resolution: {integrity: sha512-+A1YivoVDNNVCdfozHSR8v/jyuuLTMXwjWuxPFlFlUapXoGc+Gj9mDlTDDfrwl7rXCl2tNZ0kE8sIBO6YOn96Q==}
|
||||
/@colors/colors/1.5.0:
|
||||
resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==}
|
||||
engines: {node: '>=0.1.90'}
|
||||
dev: false
|
||||
|
||||
/@dabh/diagnostics/2.0.3:
|
||||
resolution: {integrity: sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA==}
|
||||
dependencies:
|
||||
colorspace: 1.1.4
|
||||
enabled: 2.0.0
|
||||
kuler: 2.0.0
|
||||
dev: false
|
||||
|
||||
/@types/cloudflare/2.7.7:
|
||||
resolution: {integrity: sha512-BPihnRqzm+NtFPG9gNd+Asf/KGcFfBY3zc53j9P7dW9qh3V+3wrYTBc1SOQs/DLDJxdpc+HI0N26NImAfZxg5g==}
|
||||
/@types/cloudflare/2.7.8:
|
||||
resolution: {integrity: sha512-Ww0+DV8Um7Rtr8DI4ZTwHWylJ73HyOSBdiqXz6JWt1jcXotL/3vWEHmrtx8qBWQOS5Epusp7J86ocYhaSur6ag==}
|
||||
dev: true
|
||||
|
||||
/@types/cron/1.7.3:
|
||||
resolution: {integrity: sha512-iPmUXyIJG1Js+ldPYhOQcYU3kCAQ2FWrSkm1FJPoii2eYSn6wEW6onPukNTT0bfiflexNSRPl6KWmAIqS+36YA==}
|
||||
dependencies:
|
||||
'@types/node': 17.0.15
|
||||
moment: 2.29.1
|
||||
'@types/node': 17.0.33
|
||||
moment: 2.29.3
|
||||
dev: true
|
||||
|
||||
/@types/node/17.0.15:
|
||||
resolution: {integrity: sha512-zWt4SDDv1S9WRBNxLFxFRHxdD9tvH8f5/kg5/IaLFdnSNXsDY4eL3Q3XXN+VxUnWIhyVFDwcsmAprvwXoM/ClA==}
|
||||
dev: true
|
||||
/@types/keyv/3.1.4:
|
||||
resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==}
|
||||
dependencies:
|
||||
'@types/node': 17.0.33
|
||||
dev: false
|
||||
|
||||
/@types/node/17.0.33:
|
||||
resolution: {integrity: sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ==}
|
||||
|
||||
/@types/responselike/1.0.0:
|
||||
resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==}
|
||||
dependencies:
|
||||
'@types/node': 17.0.33
|
||||
dev: false
|
||||
|
||||
/@types/strip-bom/3.0.0:
|
||||
resolution: {integrity: sha1-FKjsOVbC6B7bdSB5CuzyHCkK69I=}
|
||||
@ -61,7 +77,7 @@ packages:
|
||||
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
|
||||
engines: {node: '>= 6.0.0'}
|
||||
dependencies:
|
||||
debug: 4.3.3
|
||||
debug: 4.3.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
@ -82,14 +98,19 @@ packages:
|
||||
resolution: {integrity: sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==}
|
||||
dev: false
|
||||
|
||||
/asynckit/0.4.0:
|
||||
resolution: {integrity: sha1-x57Zf380y48robyXkLzDZkdLS3k=}
|
||||
dev: false
|
||||
|
||||
/autocreate/1.2.0:
|
||||
resolution: {integrity: sha1-UiFnmSxBcsFUeeX4jzSGpFKkDLo=}
|
||||
dev: false
|
||||
|
||||
/axios/0.25.0:
|
||||
resolution: {integrity: sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==}
|
||||
/axios/0.27.2:
|
||||
resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==}
|
||||
dependencies:
|
||||
follow-redirects: 1.14.7
|
||||
follow-redirects: 1.15.0
|
||||
form-data: 4.0.0
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
dev: false
|
||||
@ -147,7 +168,7 @@ packages:
|
||||
autocreate: 1.2.0
|
||||
es-class: 2.1.1
|
||||
got: 6.7.1
|
||||
https-proxy-agent: 5.0.0
|
||||
https-proxy-agent: 5.0.1
|
||||
object-assign: 4.1.1
|
||||
should-proxy: 1.0.4
|
||||
url-pattern: 1.0.3
|
||||
@ -169,8 +190,8 @@ packages:
|
||||
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
|
||||
dev: false
|
||||
|
||||
/color-string/1.9.0:
|
||||
resolution: {integrity: sha512-9Mrz2AQLefkH1UvASKj6v6hj/7eWgjnT/cVsR8CumieLoT+g900exWeNogqtweI8dxloXN9BDQTYro1oWu/5CQ==}
|
||||
/color-string/1.9.1:
|
||||
resolution: {integrity: sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==}
|
||||
dependencies:
|
||||
color-name: 1.1.4
|
||||
simple-swizzle: 0.2.2
|
||||
@ -180,12 +201,7 @@ packages:
|
||||
resolution: {integrity: sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==}
|
||||
dependencies:
|
||||
color-convert: 1.9.3
|
||||
color-string: 1.9.0
|
||||
dev: false
|
||||
|
||||
/colors/1.4.0:
|
||||
resolution: {integrity: sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==}
|
||||
engines: {node: '>=0.1.90'}
|
||||
color-string: 1.9.1
|
||||
dev: false
|
||||
|
||||
/colorspace/1.1.4:
|
||||
@ -195,6 +211,13 @@ packages:
|
||||
text-hex: 1.0.0
|
||||
dev: false
|
||||
|
||||
/combined-stream/1.0.8:
|
||||
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
|
||||
engines: {node: '>= 0.8'}
|
||||
dependencies:
|
||||
delayed-stream: 1.0.0
|
||||
dev: false
|
||||
|
||||
/concat-map/0.0.1:
|
||||
resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=}
|
||||
dev: true
|
||||
@ -216,8 +239,8 @@ packages:
|
||||
moment-timezone: 0.5.34
|
||||
dev: false
|
||||
|
||||
/debug/4.3.3:
|
||||
resolution: {integrity: sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==}
|
||||
/debug/4.3.4:
|
||||
resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==}
|
||||
engines: {node: '>=6.0'}
|
||||
peerDependencies:
|
||||
supports-color: '*'
|
||||
@ -228,13 +251,18 @@ packages:
|
||||
ms: 2.1.2
|
||||
dev: false
|
||||
|
||||
/delayed-stream/1.0.0:
|
||||
resolution: {integrity: sha1-3zrhmayt+31ECqrgsp4icrJOxhk=}
|
||||
engines: {node: '>=0.4.0'}
|
||||
dev: false
|
||||
|
||||
/diff/4.0.2:
|
||||
resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
|
||||
engines: {node: '>=0.3.1'}
|
||||
dev: true
|
||||
|
||||
/dotenv/16.0.0:
|
||||
resolution: {integrity: sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==}
|
||||
/dotenv/16.0.1:
|
||||
resolution: {integrity: sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==}
|
||||
engines: {node: '>=12'}
|
||||
dev: false
|
||||
|
||||
@ -256,8 +284,8 @@ packages:
|
||||
resolution: {integrity: sha1-bsIkO1oeNYHAt+7O4BMMnA1vsrc=}
|
||||
dev: false
|
||||
|
||||
/fecha/4.2.1:
|
||||
resolution: {integrity: sha512-MMMQ0ludy/nBs1/o0zVOiKTpG7qMbonKUzjJgQFEuvq6INZ1OraKPRAWkBq5vlKLOUMpmNYG1JoN3oDPUQ9m3Q==}
|
||||
/fecha/4.2.3:
|
||||
resolution: {integrity: sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==}
|
||||
dev: false
|
||||
|
||||
/fill-range/7.0.1:
|
||||
@ -271,8 +299,8 @@ packages:
|
||||
resolution: {integrity: sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw==}
|
||||
dev: false
|
||||
|
||||
/follow-redirects/1.14.7:
|
||||
resolution: {integrity: sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==}
|
||||
/follow-redirects/1.15.0:
|
||||
resolution: {integrity: sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==}
|
||||
engines: {node: '>=4.0'}
|
||||
peerDependencies:
|
||||
debug: '*'
|
||||
@ -281,6 +309,15 @@ packages:
|
||||
optional: true
|
||||
dev: false
|
||||
|
||||
/form-data/4.0.0:
|
||||
resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}
|
||||
engines: {node: '>= 6'}
|
||||
dependencies:
|
||||
asynckit: 0.4.0
|
||||
combined-stream: 1.0.8
|
||||
mime-types: 2.1.35
|
||||
dev: false
|
||||
|
||||
/fs.realpath/1.0.0:
|
||||
resolution: {integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8=}
|
||||
dev: true
|
||||
@ -309,13 +346,13 @@ packages:
|
||||
is-glob: 4.0.3
|
||||
dev: true
|
||||
|
||||
/glob/7.2.0:
|
||||
resolution: {integrity: sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==}
|
||||
/glob/7.2.2:
|
||||
resolution: {integrity: sha512-NzDgHDiJwKYByLrL5lONmQFpK/2G78SMMfo+E9CuGlX4IkvfKDsiQSNPwAYxEy+e6p7ZQ3uslSLlwlJcqezBmQ==}
|
||||
dependencies:
|
||||
fs.realpath: 1.0.0
|
||||
inflight: 1.0.6
|
||||
inherits: 2.0.4
|
||||
minimatch: 3.0.5
|
||||
minimatch: 3.1.2
|
||||
once: 1.4.0
|
||||
path-is-absolute: 1.0.1
|
||||
dev: true
|
||||
@ -324,6 +361,8 @@ packages:
|
||||
resolution: {integrity: sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
'@types/keyv': 3.1.4
|
||||
'@types/responselike': 1.0.0
|
||||
create-error-class: 3.0.2
|
||||
duplexer3: 0.1.4
|
||||
get-stream: 3.0.0
|
||||
@ -344,12 +383,12 @@ packages:
|
||||
function-bind: 1.1.1
|
||||
dev: true
|
||||
|
||||
/https-proxy-agent/5.0.0:
|
||||
resolution: {integrity: sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==}
|
||||
/https-proxy-agent/5.0.1:
|
||||
resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==}
|
||||
engines: {node: '>= 6'}
|
||||
dependencies:
|
||||
agent-base: 6.0.2
|
||||
debug: 4.3.3
|
||||
debug: 4.3.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
@ -375,8 +414,8 @@ packages:
|
||||
binary-extensions: 2.2.0
|
||||
dev: true
|
||||
|
||||
/is-core-module/2.8.1:
|
||||
resolution: {integrity: sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==}
|
||||
/is-core-module/2.9.0:
|
||||
resolution: {integrity: sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==}
|
||||
dependencies:
|
||||
has: 1.0.3
|
||||
dev: true
|
||||
@ -422,13 +461,13 @@ packages:
|
||||
resolution: {integrity: sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==}
|
||||
dev: false
|
||||
|
||||
/logform/2.3.2:
|
||||
resolution: {integrity: sha512-V6JiPThZzTsbVRspNO6TmHkR99oqYTs8fivMBYQkjZj6rxW92KxtDCPE6IkAk1DNBnYKNkjm4jYBm6JDUcyhOA==}
|
||||
/logform/2.4.0:
|
||||
resolution: {integrity: sha512-CPSJw4ftjf517EhXZGGvTHHkYobo7ZCc0kvwUoOYcjfR2UVrI66RHj8MCrfAdEitdmFqbu2BYdYs8FHHZSb6iw==}
|
||||
dependencies:
|
||||
colors: 1.4.0
|
||||
fecha: 4.2.1
|
||||
'@colors/colors': 1.5.0
|
||||
fecha: 4.2.3
|
||||
ms: 2.1.3
|
||||
safe-stable-stringify: 1.1.1
|
||||
safe-stable-stringify: 2.3.1
|
||||
triple-beam: 1.3.0
|
||||
dev: false
|
||||
|
||||
@ -441,14 +480,26 @@ packages:
|
||||
resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==}
|
||||
dev: true
|
||||
|
||||
/minimatch/3.0.5:
|
||||
resolution: {integrity: sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==}
|
||||
/mime-db/1.52.0:
|
||||
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
|
||||
engines: {node: '>= 0.6'}
|
||||
dev: false
|
||||
|
||||
/mime-types/2.1.35:
|
||||
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
dependencies:
|
||||
mime-db: 1.52.0
|
||||
dev: false
|
||||
|
||||
/minimatch/3.1.2:
|
||||
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
|
||||
dependencies:
|
||||
brace-expansion: 1.1.11
|
||||
dev: true
|
||||
|
||||
/minimist/1.2.5:
|
||||
resolution: {integrity: sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==}
|
||||
/minimist/1.2.6:
|
||||
resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==}
|
||||
dev: true
|
||||
|
||||
/mkdirp/1.0.4:
|
||||
@ -460,11 +511,11 @@ packages:
|
||||
/moment-timezone/0.5.34:
|
||||
resolution: {integrity: sha512-3zAEHh2hKUs3EXLESx/wsgw6IQdusOT8Bxm3D9UrHPQR7zlMmzwybC8zHEM1tQ4LJwP7fcxrWr8tuBg05fFCbg==}
|
||||
dependencies:
|
||||
moment: 2.29.1
|
||||
moment: 2.29.3
|
||||
dev: false
|
||||
|
||||
/moment/2.29.1:
|
||||
resolution: {integrity: sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==}
|
||||
/moment/2.29.3:
|
||||
resolution: {integrity: sha512-c6YRvhEo//6T2Jz/vVtYzqBzwvPT95JBQ+smCytzf7c50oMZRsR/a4w88aD34I+/QVSfnoAnSBFPJHItlOMJVw==}
|
||||
|
||||
/ms/2.1.2:
|
||||
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
||||
@ -535,7 +586,7 @@ packages:
|
||||
resolution: {integrity: sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
is-core-module: 2.8.1
|
||||
is-core-module: 2.9.0
|
||||
path-parse: 1.0.7
|
||||
supports-preserve-symlinks-flag: 1.0.0
|
||||
dev: true
|
||||
@ -544,17 +595,13 @@ packages:
|
||||
resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
glob: 7.2.0
|
||||
glob: 7.2.2
|
||||
dev: true
|
||||
|
||||
/safe-buffer/5.2.1:
|
||||
resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==}
|
||||
dev: false
|
||||
|
||||
/safe-stable-stringify/1.1.1:
|
||||
resolution: {integrity: sha512-ERq4hUjKDbJfE4+XtZLFPCDi8Vb1JqaxAPTxWFLBx8XcAlf9Bda/ZJdVezs/NAfsMQScyIlUMx+Yeu7P7rx5jw==}
|
||||
dev: false
|
||||
|
||||
/safe-stable-stringify/2.3.1:
|
||||
resolution: {integrity: sha512-kYBSfT+troD9cDA85VDnHZ1rpHC50O0g1e6WlGHVCz/g+JS+9WKLj+XwFYyR8UbrZN8ll9HUpDAAddY58MGisg==}
|
||||
engines: {node: '>=10'}
|
||||
@ -632,7 +679,7 @@ packages:
|
||||
resolution: {integrity: sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw==}
|
||||
dev: false
|
||||
|
||||
/ts-node-dev/1.1.8_typescript@4.5.5:
|
||||
/ts-node-dev/1.1.8_typescript@4.6.4:
|
||||
resolution: {integrity: sha512-Q/m3vEwzYwLZKmV6/0VlFxcZzVV/xcgOt+Tx/VjaaRHyiBcFlV0541yrT09QjzzCxlDZ34OzKjrFAynlmtflEg==}
|
||||
engines: {node: '>=0.8.0'}
|
||||
hasBin: true
|
||||
@ -645,18 +692,18 @@ packages:
|
||||
dependencies:
|
||||
chokidar: 3.5.3
|
||||
dynamic-dedupe: 0.3.0
|
||||
minimist: 1.2.5
|
||||
minimist: 1.2.6
|
||||
mkdirp: 1.0.4
|
||||
resolve: 1.22.0
|
||||
rimraf: 2.7.1
|
||||
source-map-support: 0.5.21
|
||||
tree-kill: 1.2.2
|
||||
ts-node: 9.1.1_typescript@4.5.5
|
||||
ts-node: 9.1.1_typescript@4.6.4
|
||||
tsconfig: 7.0.0
|
||||
typescript: 4.5.5
|
||||
typescript: 4.6.4
|
||||
dev: true
|
||||
|
||||
/ts-node/9.1.1_typescript@4.5.5:
|
||||
/ts-node/9.1.1_typescript@4.6.4:
|
||||
resolution: {integrity: sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
hasBin: true
|
||||
@ -668,7 +715,7 @@ packages:
|
||||
diff: 4.0.2
|
||||
make-error: 1.3.6
|
||||
source-map-support: 0.5.21
|
||||
typescript: 4.5.5
|
||||
typescript: 4.6.4
|
||||
yn: 3.1.1
|
||||
dev: true
|
||||
|
||||
@ -681,8 +728,8 @@ packages:
|
||||
strip-json-comments: 2.0.1
|
||||
dev: true
|
||||
|
||||
/typescript/4.5.5:
|
||||
resolution: {integrity: sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA==}
|
||||
/typescript/4.6.4:
|
||||
resolution: {integrity: sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg==}
|
||||
engines: {node: '>=4.2.0'}
|
||||
hasBin: true
|
||||
dev: true
|
||||
@ -712,19 +759,19 @@ packages:
|
||||
resolution: {integrity: sha512-YpZzcUzBedhlTAfJg6vJDlyEai/IFMIVcaEZZyl3UXIl4gmqRpU7AE89AHLkbzLUsv0NVmw7ts+iztqKxxPW1Q==}
|
||||
engines: {node: '>= 6.4.0'}
|
||||
dependencies:
|
||||
logform: 2.3.2
|
||||
logform: 2.4.0
|
||||
readable-stream: 3.6.0
|
||||
triple-beam: 1.3.0
|
||||
dev: false
|
||||
|
||||
/winston/3.5.1:
|
||||
resolution: {integrity: sha512-tbRtVy+vsSSCLcZq/8nXZaOie/S2tPXPFt4be/Q3vI/WtYwm7rrwidxVw2GRa38FIXcJ1kUM6MOZ9Jmnk3F3UA==}
|
||||
engines: {node: '>= 6.4.0'}
|
||||
/winston/3.7.2:
|
||||
resolution: {integrity: sha512-QziIqtojHBoyzUOdQvQiar1DH0Xp9nF1A1y7NVy2DGEsz82SBDtOalS0ulTRGVT14xPX3WRWkCsdcJKqNflKng==}
|
||||
engines: {node: '>= 12.0.0'}
|
||||
dependencies:
|
||||
'@dabh/diagnostics': 2.0.2
|
||||
'@dabh/diagnostics': 2.0.3
|
||||
async: 3.2.3
|
||||
is-stream: 2.0.1
|
||||
logform: 2.3.2
|
||||
logform: 2.4.0
|
||||
one-time: 1.0.0
|
||||
readable-stream: 3.6.0
|
||||
safe-stable-stringify: 2.3.1
|
||||
|
17
src/index.ts
17
src/index.ts
@ -38,7 +38,10 @@ type DNSRecord = {
|
||||
zone: string
|
||||
record: string
|
||||
ip: string
|
||||
proxied: boolean
|
||||
}
|
||||
|
||||
type DNSBrowseResult = { result: { id: string; type: string; name: string; proxied: boolean; ttl: number }[] }
|
||||
async function update(cf: Cloudflare, options: DNSRecord) {
|
||||
// Find zone
|
||||
if (!Cache.has('zone')) {
|
||||
@ -56,9 +59,8 @@ async function update(cf: Cloudflare, options: DNSRecord) {
|
||||
logger.debug(`Zone ID: ${zoneId}`)
|
||||
|
||||
// Set record
|
||||
const records: { result: { id: string; type: string; name: string; ttl: number }[] } = (await cf.dnsRecords.browse(
|
||||
zoneId
|
||||
)) as any
|
||||
|
||||
const records: DNSBrowseResult = (await cf.dnsRecords.browse(zoneId)) as any
|
||||
const relevant = records.result.filter((r) => r.name === options.record && r.type === 'A')
|
||||
if (relevant.length === 0) {
|
||||
// Create DNS Record
|
||||
@ -67,6 +69,7 @@ async function update(cf: Cloudflare, options: DNSRecord) {
|
||||
type: 'A',
|
||||
name: options.record,
|
||||
content: options.ip,
|
||||
proxied: options.proxied,
|
||||
ttl: 1,
|
||||
})
|
||||
} else {
|
||||
@ -84,6 +87,7 @@ async function update(cf: Cloudflare, options: DNSRecord) {
|
||||
type: 'A',
|
||||
name: options.record,
|
||||
content: options.ip,
|
||||
proxied: options.proxied,
|
||||
ttl: record.ttl,
|
||||
})
|
||||
logger.info(`Updated DNS record ${record.name}`)
|
||||
@ -92,7 +96,7 @@ async function update(cf: Cloudflare, options: DNSRecord) {
|
||||
|
||||
async function main() {
|
||||
config()
|
||||
const { EMAIL, KEY, TOKEN, ZONE, DNS_RECORD, CRON, RESOLVER } = process.env
|
||||
const { EMAIL, KEY, TOKEN, ZONE, DNS_RECORD, PROXIED, CRON, RESOLVER } = process.env
|
||||
if (!ZONE || !DNS_RECORD) {
|
||||
logger.error('Missing environment variables')
|
||||
process.exit(1)
|
||||
@ -105,7 +109,10 @@ async function main() {
|
||||
const ip = await getCurrentIp(RESOLVER)
|
||||
const changed = checkIfUpdateIsRequired(ip)
|
||||
logger.info(`Running. Update required: ${!!changed}`)
|
||||
if (changed) await update(cf, { ip, record: DNS_RECORD!, zone: ZONE! }).catch((e) => logger.error(e.message))
|
||||
if (changed)
|
||||
await update(cf, { ip, record: DNS_RECORD!, zone: ZONE!, proxied: Boolean(PROXIED) }).catch((e) =>
|
||||
logger.error(e.message)
|
||||
)
|
||||
}
|
||||
|
||||
const cron = new CronJob(CRON || '*/5 * * * *', fn, null, true, undefined, null, true)
|
||||
|
Loading…
Reference in New Issue
Block a user