Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
ca7565c7c8 | |||
3ba598448b | |||
|
ebb262dfee | ||
4143fc71e8 | |||
|
082d91815a | ||
|
93d376614c | ||
|
e4c92e7b6b | ||
|
56dbe10fb1 | ||
8122259fe8 | |||
da11381fd1 | |||
fe2d6931d7 | |||
4155345f57 | |||
21928ee740 |
19
.github/dependabot.yml
vendored
Normal file
19
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
|
# package ecosystems to update and where the package manifests are located.
|
||||||
|
# Please see the documentation for all configuration options:
|
||||||
|
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
|
||||||
|
# Maintain dependencies for GitHub Actions
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
|
|
||||||
|
# Maintain dependencies for Golang
|
||||||
|
- package-ecosystem: "gomod"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
19
.github/renovate.json
vendored
19
.github/renovate.json
vendored
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [
|
|
||||||
"config:base"
|
|
||||||
],
|
|
||||||
"packageRules": [
|
|
||||||
{
|
|
||||||
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
|
|
||||||
"automerge": true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"groupName": "all deps",
|
|
||||||
"separateMajorMinor": true,
|
|
||||||
"groupSlug": "all",
|
|
||||||
"packagePatterns": [
|
|
||||||
"*"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
13
.github/stale.sh
vendored
13
.github/stale.sh
vendored
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash -ex
|
|
||||||
|
|
||||||
export PATH=$PATH:$(pwd)/bin
|
|
||||||
export GO111MODULE=on
|
|
||||||
export GOBIN=$(pwd)/bin
|
|
||||||
|
|
||||||
#go get github.com/rvflash/goup@v0.4.1
|
|
||||||
|
|
||||||
#goup -v ./...
|
|
||||||
#go get github.com/psampaz/go-mod-outdated@v0.6.0
|
|
||||||
go list -u -m -mod=mod -json all | go-mod-outdated -update -direct -ci || true
|
|
||||||
|
|
||||||
#go list -u -m -json all | go-mod-outdated -update
|
|
78
.github/workflows/codeql-analysis.yml
vendored
Normal file
78
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
# For most projects, this workflow file will not need changing; you simply need
|
||||||
|
# to commit it to your repository.
|
||||||
|
#
|
||||||
|
# You may wish to alter this file to override the set of languages analyzed,
|
||||||
|
# or to provide custom queries or build logic.
|
||||||
|
#
|
||||||
|
# ******** NOTE ********
|
||||||
|
# We have attempted to detect the languages in your repository. Please check
|
||||||
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
|
# supported CodeQL languages.
|
||||||
|
#
|
||||||
|
name: "codeql"
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["prbuild"]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
push:
|
||||||
|
branches: [ master, v3 ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ master, v3 ]
|
||||||
|
schedule:
|
||||||
|
- cron: '34 1 * * 0'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
analyze:
|
||||||
|
name: analyze
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
language: [ 'go' ]
|
||||||
|
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
||||||
|
# Learn more:
|
||||||
|
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: setup
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.16
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: init
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: ${{ matrix.language }}
|
||||||
|
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||||
|
# By default, queries listed here will override any specified in a config file.
|
||||||
|
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||||
|
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
#- run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: analyze
|
||||||
|
uses: github/codeql-action/analyze@v1
|
31
.github/workflows/dependabot-automerge.yml
vendored
Normal file
31
.github/workflows/dependabot-automerge.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: "prautomerge"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types: [assigned, opened, synchronize, reopened]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
dependabot:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.actor == 'dependabot[bot]' }}
|
||||||
|
steps:
|
||||||
|
- name: metadata
|
||||||
|
id: metadata
|
||||||
|
uses: dependabot/fetch-metadata@v1.1.1
|
||||||
|
with:
|
||||||
|
github-token: "${{ secrets.TOKEN }}"
|
||||||
|
- name: approve
|
||||||
|
run: gh pr review --approve "$PR_URL"
|
||||||
|
env:
|
||||||
|
PR_URL: ${{github.event.pull_request.html_url}}
|
||||||
|
GITHUB_TOKEN: ${{secrets.TOKEN}}
|
||||||
|
- name: merge
|
||||||
|
if: ${{contains(steps.metadata.outputs.dependency-names, 'go.unistack.org')}}
|
||||||
|
run: gh pr merge --auto --merge "$PR_URL"
|
||||||
|
env:
|
||||||
|
PR_URL: ${{github.event.pull_request.html_url}}
|
||||||
|
GITHUB_TOKEN: ${{secrets.TOKEN}}
|
13
go.mod
13
go.mod
@@ -1,12 +1,9 @@
|
|||||||
module github.com/unistack-org/micro-register-mdns/v3
|
module go.unistack.org/micro-register-mdns/v3
|
||||||
|
|
||||||
go 1.15
|
go 1.16
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/google/uuid v1.2.0
|
github.com/miekg/dns v1.1.43
|
||||||
github.com/miekg/dns v1.1.31
|
go.unistack.org/micro/v3 v3.8.7
|
||||||
github.com/unistack-org/micro/v3 v3.2.14
|
golang.org/x/net v0.0.0-20211020060615-d418f374d309
|
||||||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect
|
|
||||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777
|
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
|
|
||||||
)
|
)
|
||||||
|
66
go.sum
66
go.sum
@@ -1,46 +1,36 @@
|
|||||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
|
||||||
github.com/ef-ds/deque v1.0.4/go.mod h1:gXDnTC3yqvBcHbq2lcExjtAcVrOnJCbMcZXmuj8Z4tg=
|
github.com/ef-ds/deque v1.0.4/go.mod h1:gXDnTC3yqvBcHbq2lcExjtAcVrOnJCbMcZXmuj8Z4tg=
|
||||||
github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
|
github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
||||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs=
|
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||||
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/heimdalr/dag v1.0.1/go.mod h1:t+ZkR+sjKL4xhlE1B9rwpvwfo+x+2R0363efS+Oghns=
|
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||||
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4=
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
|
||||||
github.com/miekg/dns v1.1.31 h1:sJFOl9BgwbYAWOGEwr61FU28pqsBNdpRBnhGXtO06Oo=
|
|
||||||
github.com/miekg/dns v1.1.31/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
|
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
|
||||||
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
|
||||||
github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
|
github.com/silas/dag v0.0.0-20210626123444-3804bac2d6d4/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
|
||||||
github.com/unistack-org/micro/v3 v3.2.14 h1:BD7JR2W0WlJvJgHN3uPWrE/vNAGyxhIQrIODeDCfoSk=
|
go.unistack.org/micro-proto/v3 v3.1.0 h1:q39FwjFiRZn+Ux/tt+d3bJTmDtsQQWa+3SLYVo1vLfA=
|
||||||
github.com/unistack-org/micro/v3 v3.2.14/go.mod h1:3j13mSd/rILNjyP0tEVtDxyDkJBtnHUXShNCuPHkC5A=
|
go.unistack.org/micro-proto/v3 v3.1.0/go.mod h1:DpRhYCBXlmSJ/AAXTmntvlh7kQkYU6eFvlmYAx4BQS8=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
go.unistack.org/micro/v3 v3.8.7 h1:k1zOpJ3uS8MxdhK8annRsa5J/LW7MpqPjwYuekW61wE=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
go.unistack.org/micro/v3 v3.8.7/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA=
|
||||||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
golang.org/x/net v0.0.0-20211020060615-d418f374d309 h1:A0lJIi+hcTR6aajJH4YqKWwohY4aW9RO7oRMcdv+HKI=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||||
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew=
|
|
||||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
|
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
|
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c=
|
||||||
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||||
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||||
|
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
|
||||||
|
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
30
mdns.go
30
mdns.go
@@ -1,4 +1,4 @@
|
|||||||
package mdns
|
package mdns // import "go.unistack.org/micro-register-mdns/v3"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -14,10 +14,10 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
util "go.unistack.org/micro-register-mdns/v3/util"
|
||||||
util "github.com/unistack-org/micro-register-mdns/v3/util"
|
"go.unistack.org/micro/v3/logger"
|
||||||
"github.com/unistack-org/micro/v3/logger"
|
"go.unistack.org/micro/v3/register"
|
||||||
"github.com/unistack-org/micro/v3/register"
|
"go.unistack.org/micro/v3/util/id"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -234,7 +234,7 @@ func registerService(service *register.Service, entries []*mdnsEntry, options re
|
|||||||
var seen bool
|
var seen bool
|
||||||
|
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
if node.Id == entry.id {
|
if node.ID == entry.id {
|
||||||
seen = true
|
seen = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -251,7 +251,6 @@ func registerService(service *register.Service, entries []*mdnsEntry, options re
|
|||||||
Endpoints: service.Endpoints,
|
Endpoints: service.Endpoints,
|
||||||
Metadata: node.Metadata,
|
Metadata: node.Metadata,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
lastError = err
|
lastError = err
|
||||||
continue
|
continue
|
||||||
@@ -269,7 +268,7 @@ func registerService(service *register.Service, entries []*mdnsEntry, options re
|
|||||||
}
|
}
|
||||||
// we got here, new node
|
// we got here, new node
|
||||||
s, err := util.NewMDNSService(
|
s, err := util.NewMDNSService(
|
||||||
node.Id,
|
node.ID,
|
||||||
service.Name,
|
service.Name,
|
||||||
options.Domain+".",
|
options.Domain+".",
|
||||||
"",
|
"",
|
||||||
@@ -288,7 +287,7 @@ func registerService(service *register.Service, entries []*mdnsEntry, options re
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
entries = append(entries, &mdnsEntry{id: node.Id, node: srv})
|
entries = append(entries, &mdnsEntry{id: node.ID, node: srv})
|
||||||
}
|
}
|
||||||
|
|
||||||
return entries, lastError
|
return entries, lastError
|
||||||
@@ -388,7 +387,7 @@ func (m *mdnsRegister) Deregister(ctx context.Context, service *register.Service
|
|||||||
var remove bool
|
var remove bool
|
||||||
|
|
||||||
for _, node := range service.Nodes {
|
for _, node := range service.Nodes {
|
||||||
if node.Id == entry.id {
|
if node.ID == entry.id {
|
||||||
entry.node.Shutdown()
|
entry.node.Shutdown()
|
||||||
remove = true
|
remove = true
|
||||||
break
|
break
|
||||||
@@ -500,7 +499,7 @@ func (m *mdnsRegister) LookupService(ctx context.Context, service string, opts .
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
s.Nodes = append(s.Nodes, ®ister.Node{
|
s.Nodes = append(s.Nodes, ®ister.Node{
|
||||||
Id: strings.TrimSuffix(e.Name, "."+p.Service+"."+p.Domain+"."),
|
ID: strings.TrimSuffix(e.Name, "."+p.Service+"."+p.Domain+"."),
|
||||||
Address: fmt.Sprintf("%s:%d", addr, e.Port),
|
Address: fmt.Sprintf("%s:%d", addr, e.Port),
|
||||||
Metadata: txt.Metadata,
|
Metadata: txt.Metadata,
|
||||||
})
|
})
|
||||||
@@ -606,13 +605,17 @@ func (m *mdnsRegister) Watch(ctx context.Context, opts ...register.WatchOption)
|
|||||||
}
|
}
|
||||||
|
|
||||||
md := &mdnsWatcher{
|
md := &mdnsWatcher{
|
||||||
id: uuid.New().String(),
|
|
||||||
wo: wo,
|
wo: wo,
|
||||||
ch: make(chan *util.ServiceEntry, 32),
|
ch: make(chan *util.ServiceEntry, 32),
|
||||||
exit: make(chan struct{}),
|
exit: make(chan struct{}),
|
||||||
domain: wo.Domain,
|
domain: wo.Domain,
|
||||||
registry: m,
|
registry: m,
|
||||||
}
|
}
|
||||||
|
id, err := id.New()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
md.id = id
|
||||||
|
|
||||||
m.mtx.Lock()
|
m.mtx.Lock()
|
||||||
defer m.mtx.Unlock()
|
defer m.mtx.Unlock()
|
||||||
@@ -676,7 +679,6 @@ func (m *mdnsRegister) Watch(ctx context.Context, opts ...register.WatchOption)
|
|||||||
m.mtx.RUnlock()
|
m.mtx.RUnlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// start listening, blocking call
|
// start listening, blocking call
|
||||||
@@ -746,7 +748,7 @@ func (m *mdnsWatcher) Next() (*register.Result, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
service.Nodes = append(service.Nodes, ®ister.Node{
|
service.Nodes = append(service.Nodes, ®ister.Node{
|
||||||
Id: strings.TrimSuffix(e.Name, suffix),
|
ID: strings.TrimSuffix(e.Name, suffix),
|
||||||
Address: fmt.Sprintf("%s:%d", addr, e.Port),
|
Address: fmt.Sprintf("%s:%d", addr, e.Port),
|
||||||
Metadata: txt.Metadata,
|
Metadata: txt.Metadata,
|
||||||
})
|
})
|
||||||
|
66
mdns_test.go
66
mdns_test.go
@@ -1,14 +1,17 @@
|
|||||||
package mdns
|
package mdns
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/unistack-org/micro/v3/register"
|
"go.unistack.org/micro/v3/register"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMDNS(t *testing.T) {
|
func TestMDNS(t *testing.T) {
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
// skip test in travis because of sendto: operation not permitted error
|
// skip test in travis because of sendto: operation not permitted error
|
||||||
if travis := os.Getenv("TRAVIS"); travis == "true" {
|
if travis := os.Getenv("TRAVIS"); travis == "true" {
|
||||||
t.Skip()
|
t.Skip()
|
||||||
@@ -20,7 +23,7 @@ func TestMDNS(t *testing.T) {
|
|||||||
Version: "1.0.1",
|
Version: "1.0.1",
|
||||||
Nodes: []*register.Node{
|
Nodes: []*register.Node{
|
||||||
{
|
{
|
||||||
Id: "test1-1",
|
ID: "test1-1",
|
||||||
Address: "10.0.0.1:10001",
|
Address: "10.0.0.1:10001",
|
||||||
Metadata: map[string]string{
|
Metadata: map[string]string{
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
@@ -33,7 +36,7 @@ func TestMDNS(t *testing.T) {
|
|||||||
Version: "1.0.2",
|
Version: "1.0.2",
|
||||||
Nodes: []*register.Node{
|
Nodes: []*register.Node{
|
||||||
{
|
{
|
||||||
Id: "test2-1",
|
ID: "test2-1",
|
||||||
Address: "10.0.0.2:10002",
|
Address: "10.0.0.2:10002",
|
||||||
Metadata: map[string]string{
|
Metadata: map[string]string{
|
||||||
"foo2": "bar2",
|
"foo2": "bar2",
|
||||||
@@ -46,7 +49,7 @@ func TestMDNS(t *testing.T) {
|
|||||||
Version: "1.0.3",
|
Version: "1.0.3",
|
||||||
Nodes: []*register.Node{
|
Nodes: []*register.Node{
|
||||||
{
|
{
|
||||||
Id: "test3-1",
|
ID: "test3-1",
|
||||||
Address: "10.0.0.3:10003",
|
Address: "10.0.0.3:10003",
|
||||||
Metadata: map[string]string{
|
Metadata: map[string]string{
|
||||||
"foo3": "bar3",
|
"foo3": "bar3",
|
||||||
@@ -69,12 +72,12 @@ func TestMDNS(t *testing.T) {
|
|||||||
|
|
||||||
for _, service := range testData {
|
for _, service := range testData {
|
||||||
// register service
|
// register service
|
||||||
if err := r.Register(service); err != nil {
|
if err := r.Register(ctx, service); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get registered service
|
// get registered service
|
||||||
s, err := r.LookupService(service.Name)
|
s, err := r.LookupService(ctx, service.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -97,8 +100,8 @@ func TestMDNS(t *testing.T) {
|
|||||||
|
|
||||||
node := s[0].Nodes[0]
|
node := s[0].Nodes[0]
|
||||||
|
|
||||||
if node.Id != service.Nodes[0].Id {
|
if node.ID != service.Nodes[0].ID {
|
||||||
t.Fatalf("Expected node id %s got %s", service.Nodes[0].Id, node.Id)
|
t.Fatalf("Expected node id %s got %s", service.Nodes[0].ID, node.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
if node.Address != service.Nodes[0].Address {
|
if node.Address != service.Nodes[0].Address {
|
||||||
@@ -106,7 +109,7 @@ func TestMDNS(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
services, err := r.ListServices()
|
services, err := r.ListServices(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -124,19 +127,18 @@ func TestMDNS(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// deregister
|
// deregister
|
||||||
if err := r.Deregister(service); err != nil {
|
if err := r.Deregister(ctx, service); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
time.Sleep(time.Millisecond * 5)
|
time.Sleep(time.Millisecond * 5)
|
||||||
|
|
||||||
// check its gone
|
// check its gone
|
||||||
s, _ := r.GetService(service.Name)
|
s, _ := r.LookupService(ctx, service.Name)
|
||||||
if len(s) > 0 {
|
if len(s) > 0 {
|
||||||
t.Fatalf("Expected nothing got %+v", s[0])
|
t.Fatalf("Expected nothing got %+v", s[0])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEncoding(t *testing.T) {
|
func TestEncoding(t *testing.T) {
|
||||||
@@ -146,22 +148,6 @@ func TestEncoding(t *testing.T) {
|
|||||||
Metadata: map[string]string{
|
Metadata: map[string]string{
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
},
|
},
|
||||||
Endpoints: []*register.Endpoint{
|
|
||||||
{
|
|
||||||
Name: "endpoint1",
|
|
||||||
Request: ®ister.Value{
|
|
||||||
Name: "request",
|
|
||||||
Type: "request",
|
|
||||||
},
|
|
||||||
Response: ®ister.Value{
|
|
||||||
Name: "response",
|
|
||||||
Type: "response",
|
|
||||||
},
|
|
||||||
Metadata: map[string]string{
|
|
||||||
"foo1": "bar1",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,20 +172,17 @@ func TestEncoding(t *testing.T) {
|
|||||||
t.Fatalf("Expected version %s got %s", d.Version, decoded.Version)
|
t.Fatalf("Expected version %s got %s", d.Version, decoded.Version)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(decoded.Endpoints) != len(d.Endpoints) {
|
|
||||||
t.Fatalf("Expected %d endpoints, got %d", len(d.Endpoints), len(decoded.Endpoints))
|
|
||||||
}
|
|
||||||
|
|
||||||
for k, v := range d.Metadata {
|
for k, v := range d.Metadata {
|
||||||
if val := decoded.Metadata[k]; val != v {
|
if val := decoded.Metadata[k]; val != v {
|
||||||
t.Fatalf("Expected %s=%s got %s=%s", k, v, k, val)
|
t.Fatalf("Expected %s=%s got %s=%s", k, v, k, val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestWatcher(t *testing.T) {
|
func TestWatcher(t *testing.T) {
|
||||||
|
ctx := context.Background()
|
||||||
|
|
||||||
if travis := os.Getenv("TRAVIS"); travis == "true" {
|
if travis := os.Getenv("TRAVIS"); travis == "true" {
|
||||||
t.Skip()
|
t.Skip()
|
||||||
}
|
}
|
||||||
@@ -210,7 +193,7 @@ func TestWatcher(t *testing.T) {
|
|||||||
Version: "1.0.1",
|
Version: "1.0.1",
|
||||||
Nodes: []*register.Node{
|
Nodes: []*register.Node{
|
||||||
{
|
{
|
||||||
Id: "test1-1",
|
ID: "test1-1",
|
||||||
Address: "10.0.0.1:10001",
|
Address: "10.0.0.1:10001",
|
||||||
Metadata: map[string]string{
|
Metadata: map[string]string{
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
@@ -223,7 +206,7 @@ func TestWatcher(t *testing.T) {
|
|||||||
Version: "1.0.2",
|
Version: "1.0.2",
|
||||||
Nodes: []*register.Node{
|
Nodes: []*register.Node{
|
||||||
{
|
{
|
||||||
Id: "test2-1",
|
ID: "test2-1",
|
||||||
Address: "10.0.0.2:10002",
|
Address: "10.0.0.2:10002",
|
||||||
Metadata: map[string]string{
|
Metadata: map[string]string{
|
||||||
"foo2": "bar2",
|
"foo2": "bar2",
|
||||||
@@ -236,7 +219,7 @@ func TestWatcher(t *testing.T) {
|
|||||||
Version: "1.0.3",
|
Version: "1.0.3",
|
||||||
Nodes: []*register.Node{
|
Nodes: []*register.Node{
|
||||||
{
|
{
|
||||||
Id: "test3-1",
|
ID: "test3-1",
|
||||||
Address: "10.0.0.3:10003",
|
Address: "10.0.0.3:10003",
|
||||||
Metadata: map[string]string{
|
Metadata: map[string]string{
|
||||||
"foo3": "bar3",
|
"foo3": "bar3",
|
||||||
@@ -249,7 +232,6 @@ func TestWatcher(t *testing.T) {
|
|||||||
testFn := func(service, s *register.Service) {
|
testFn := func(service, s *register.Service) {
|
||||||
if s == nil {
|
if s == nil {
|
||||||
t.Fatalf("Expected one result for %s got nil", service.Name)
|
t.Fatalf("Expected one result for %s got nil", service.Name)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.Name != service.Name {
|
if s.Name != service.Name {
|
||||||
@@ -266,8 +248,8 @@ func TestWatcher(t *testing.T) {
|
|||||||
|
|
||||||
node := s.Nodes[0]
|
node := s.Nodes[0]
|
||||||
|
|
||||||
if node.Id != service.Nodes[0].Id {
|
if node.ID != service.Nodes[0].ID {
|
||||||
t.Fatalf("Expected node id %s got %s", service.Nodes[0].Id, node.Id)
|
t.Fatalf("Expected node id %s got %s", service.Nodes[0].ID, node.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
if node.Address != service.Nodes[0].Address {
|
if node.Address != service.Nodes[0].Address {
|
||||||
@@ -286,7 +268,7 @@ func TestWatcher(t *testing.T) {
|
|||||||
// new registry
|
// new registry
|
||||||
r := NewRegister(opts...)
|
r := NewRegister(opts...)
|
||||||
|
|
||||||
w, err := r.Watch()
|
w, err := r.Watch(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -294,7 +276,7 @@ func TestWatcher(t *testing.T) {
|
|||||||
|
|
||||||
for _, service := range testData {
|
for _, service := range testData {
|
||||||
// register service
|
// register service
|
||||||
if err := r.Register(service); err != nil {
|
if err := r.Register(ctx, service); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,7 +299,7 @@ func TestWatcher(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// deregister
|
// deregister
|
||||||
if err := r.Deregister(service); err != nil {
|
if err := r.Deregister(ctx, service); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@ package mdns
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/unistack-org/micro/v3/register"
|
"go.unistack.org/micro/v3/register"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Domain sets the mdnsDomain
|
// Domain sets the mdnsDomain
|
||||||
|
@@ -6,7 +6,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/unistack-org/micro/v3/logger"
|
"go.unistack.org/micro/v3/logger"
|
||||||
"golang.org/x/net/dns/dnsmessage"
|
"golang.org/x/net/dns/dnsmessage"
|
||||||
"golang.org/x/net/ipv4"
|
"golang.org/x/net/ipv4"
|
||||||
"golang.org/x/net/ipv6"
|
"golang.org/x/net/ipv6"
|
||||||
@@ -381,7 +381,6 @@ func (c *client) query(ctx context.Context, params *QueryParam) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sendQuery is used to multicast a query out
|
// sendQuery is used to multicast a query out
|
||||||
|
@@ -8,8 +8,8 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
registry "github.com/unistack-org/micro/v3/register"
|
registry "go.unistack.org/micro/v3/register"
|
||||||
regutil "github.com/unistack-org/micro/v3/util/register"
|
regutil "go.unistack.org/micro/v3/util/register"
|
||||||
"golang.org/x/net/dns/dnsmessage"
|
"golang.org/x/net/dns/dnsmessage"
|
||||||
"golang.org/x/net/ipv4"
|
"golang.org/x/net/ipv4"
|
||||||
"golang.org/x/net/ipv6"
|
"golang.org/x/net/ipv6"
|
||||||
@@ -218,7 +218,6 @@ func (s *Server) parsePacket(buf []byte, from net.Addr) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) LookupService(name string, opts ...registry.LookupOption) ([]*registry.Service, error) {
|
func (s *Server) LookupService(name string, opts ...registry.LookupOption) ([]*registry.Service, error) {
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@ package mdns
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
registry "github.com/unistack-org/micro/v3/register"
|
registry "go.unistack.org/micro/v3/register"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
Reference in New Issue
Block a user