主页 HomePage

260724-ddns-go安装使用笔记

下载安装包: https://github.com/jeessy2/ddns-go/releases

解压复制, 设置PATH

安装为服务:

D:\Storage\PortableApps\ddns-go\Binary\ddns-go.exe -s install -f 60 -cacheTimes 10 -c "D:\Storage\PortableApps\ddns-go\Config\config.yaml"

记得设置服务启动类型为自动:

Set-Service -Name ddns-go -StartupType Automatic

重置密码:

ddns-go -resetPassword 123456 -c "D:\Storage\PortableApps\ddns-go\Config\config.yaml"

卸载服务:

D:\Storage\PortableApps\ddns-go\Binary\ddns-go.exe -s uninstall

新建get-ipv6-for-ddns.ps1文件, 具体内容如下:

#!powershell.exe
$address = Get-NetIPAddress `
    -InterfaceAlias 'INT-0' `
    -AddressFamily IPv6 `
    -ErrorAction Stop |
Where-Object {
    $_.PrefixOrigin -eq 'RouterAdvertisement' -and
    $_.SuffixOrigin -eq 'Link' -and
    $_.AddressState -eq 'Preferred' -and
    -not $_.SkipAsSource -and
    $_.IPAddress -match '^[23][0-9A-Fa-f]{3}:'
} |
Sort-Object ValidLifetime -Descending |
Select-Object -First 1 -ExpandProperty IPAddress
if (-not $address) {
    Write-Error 'No suitable global IPv6 address was found.'
    exit 1
}
[Console]::Out.WriteLine($address)
exit 0

设置ddns-go: