update import paths
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
3ba598448b
commit
ca7565c7c8
21
.github/workflows/codeql-analysis.yml
vendored
21
.github/workflows/codeql-analysis.yml
vendored
@ -9,7 +9,7 @@
|
|||||||
# the `language` matrix defined below to confirm you have the correct set of
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
# supported CodeQL languages.
|
# supported CodeQL languages.
|
||||||
#
|
#
|
||||||
name: "CodeQL"
|
name: "codeql"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_run:
|
workflow_run:
|
||||||
@ -17,16 +17,16 @@ on:
|
|||||||
types:
|
types:
|
||||||
- completed
|
- completed
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [ master, v3 ]
|
||||||
pull_request:
|
pull_request:
|
||||||
# The branches below must be a subset of the branches above
|
# The branches below must be a subset of the branches above
|
||||||
branches: [ master ]
|
branches: [ master, v3 ]
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '34 1 * * 0'
|
- cron: '34 1 * * 0'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
analyze:
|
analyze:
|
||||||
name: Analyze
|
name: analyze
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
actions: read
|
actions: read
|
||||||
@ -42,11 +42,14 @@ jobs:
|
|||||||
# 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
|
# 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:
|
steps:
|
||||||
- name: Checkout repository
|
- name: checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: setup
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.16
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: init
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v1
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
@ -57,7 +60,7 @@ jobs:
|
|||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
# 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)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: autobuild
|
||||||
uses: github/codeql-action/autobuild@v1
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
@ -71,5 +74,5 @@ jobs:
|
|||||||
# make bootstrap
|
# make bootstrap
|
||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: analyze
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v1
|
||||||
|
75
.github/workflows/dependabot-automerge.yml
vendored
75
.github/workflows/dependabot-automerge.yml
vendored
@ -1,66 +1,31 @@
|
|||||||
name: "prautomerge"
|
name: "prautomerge"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_run:
|
pull_request_target:
|
||||||
workflows: ["prbuild"]
|
types: [assigned, opened, synchronize, reopened]
|
||||||
types:
|
|
||||||
- completed
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Dependabot-Automerge:
|
dependabot:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Contains workaround to execute if dependabot updates the PR by checking for the base branch in the linked PR
|
if: ${{ github.actor == 'dependabot[bot]' }}
|
||||||
# The the github.event.workflow_run.event value is 'push' and not 'pull_request'
|
|
||||||
# dont work with multiple workflows when last returns success
|
|
||||||
if: >-
|
|
||||||
github.event.workflow_run.conclusion == 'success'
|
|
||||||
&& github.actor == 'dependabot[bot]'
|
|
||||||
&& github.event.sender.login == 'dependabot[bot]'
|
|
||||||
&& github.event.sender.type == 'Bot'
|
|
||||||
&& (github.event.workflow_run.event == 'pull_request'
|
|
||||||
|| (github.event.workflow_run.event == 'push' && github.event.workflow_run.pull_requests[0].base.ref == github.event.repository.default_branch ))
|
|
||||||
steps:
|
steps:
|
||||||
- name: Approve Changes and Merge changes if label 'dependencies' is set
|
- name: metadata
|
||||||
uses: actions/github-script@v4
|
id: metadata
|
||||||
|
uses: dependabot/fetch-metadata@v1.1.1
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: "${{ secrets.TOKEN }}"
|
||||||
script: |
|
- name: approve
|
||||||
console.log(context.payload.workflow_run);
|
run: gh pr review --approve "$PR_URL"
|
||||||
|
env:
|
||||||
var labelNames = await github.paginate(
|
PR_URL: ${{github.event.pull_request.html_url}}
|
||||||
github.issues.listLabelsOnIssue,
|
GITHUB_TOKEN: ${{secrets.TOKEN}}
|
||||||
{
|
- name: merge
|
||||||
repo: context.repo.repo,
|
if: ${{contains(steps.metadata.outputs.dependency-names, 'go.unistack.org')}}
|
||||||
owner: context.repo.owner,
|
run: gh pr merge --auto --merge "$PR_URL"
|
||||||
issue_number: context.payload.workflow_run.pull_requests[0].number,
|
env:
|
||||||
},
|
PR_URL: ${{github.event.pull_request.html_url}}
|
||||||
(response) => response.data.map(
|
GITHUB_TOKEN: ${{secrets.TOKEN}}
|
||||||
(label) => label.name
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log(labelNames);
|
|
||||||
|
|
||||||
if (labelNames.includes('dependencies')) {
|
|
||||||
console.log('Found label');
|
|
||||||
|
|
||||||
await github.pulls.createReview({
|
|
||||||
repo: context.repo.repo,
|
|
||||||
owner: context.repo.owner,
|
|
||||||
pull_number: context.payload.workflow_run.pull_requests[0].number,
|
|
||||||
event: 'APPROVE'
|
|
||||||
});
|
|
||||||
console.log('Approved PR');
|
|
||||||
|
|
||||||
await github.pulls.merge({
|
|
||||||
repo: context.repo.repo,
|
|
||||||
owner: context.repo.owner,
|
|
||||||
pull_number: context.payload.workflow_run.pull_requests[0].number,
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log('Merged PR');
|
|
||||||
}
|
|
||||||
|
8
go.mod
8
go.mod
@ -1,11 +1,9 @@
|
|||||||
module github.com/unistack-org/micro-register-mdns/v3
|
module go.unistack.org/micro-register-mdns/v3
|
||||||
|
|
||||||
go 1.16
|
go 1.16
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/google/uuid v1.3.0
|
|
||||||
github.com/miekg/dns v1.1.43
|
github.com/miekg/dns v1.1.43
|
||||||
github.com/unistack-org/micro/v3 v3.7.1
|
go.unistack.org/micro/v3 v3.8.7
|
||||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5
|
golang.org/x/net v0.0.0-20211020060615-d418f374d309
|
||||||
golang.org/x/sys v0.0.0-20210603125802-9665404d3644 // indirect
|
|
||||||
)
|
)
|
||||||
|
35
go.sum
35
go.sum
@ -1,47 +1,36 @@
|
|||||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
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/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
|
||||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
|
||||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
|
||||||
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||||
github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg=
|
github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg=
|
||||||
github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4=
|
github.com/miekg/dns v1.1.43/go.mod h1:+evo5L0630/F6ca/Z9+GAqzhjGyn8/c+TBaOyfEl0V4=
|
||||||
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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/silas/dag v0.0.0-20210626123444-3804bac2d6d4/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
go.unistack.org/micro-proto/v3 v3.1.0 h1:q39FwjFiRZn+Ux/tt+d3bJTmDtsQQWa+3SLYVo1vLfA=
|
||||||
github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I=
|
go.unistack.org/micro-proto/v3 v3.1.0/go.mod h1:DpRhYCBXlmSJ/AAXTmntvlh7kQkYU6eFvlmYAx4BQS8=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
go.unistack.org/micro/v3 v3.8.7 h1:k1zOpJ3uS8MxdhK8annRsa5J/LW7MpqPjwYuekW61wE=
|
||||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
go.unistack.org/micro/v3 v3.8.7/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA=
|
||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
||||||
github.com/unistack-org/micro-proto v0.0.9 h1:KrWLS4FUX7UAWNAilQf70uad6ZPf/0EudeddCXllRVc=
|
|
||||||
github.com/unistack-org/micro-proto v0.0.9/go.mod h1:Cckwmzd89gvS7ThxzZp9kQR/EOdksFQcsTAtDDyKwrg=
|
|
||||||
github.com/unistack-org/micro/v3 v3.7.1 h1:gjCon1U8i9upNgw9+iEgbZh2LCeBizDYotQ+THHV0lo=
|
|
||||||
github.com/unistack-org/micro/v3 v3.7.1/go.mod h1:gBoY6gvzeFiJTZ4FgDttGNSs4Y1+1PRg2cV1yTRMSlg=
|
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5 h1:wjuX4b5yYQnEQHzd+CBcrcC6OVR2J1CN6mUy0oSxIPo=
|
golang.org/x/net v0.0.0-20211020060615-d418f374d309 h1:A0lJIi+hcTR6aajJH4YqKWwohY4aW9RO7oRMcdv+HKI=
|
||||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
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-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/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210603125802-9665404d3644 h1:CA1DEQ4NdKphKeL70tvsWNdT5oFh1lOjihRcEDROi0I=
|
|
||||||
golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
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.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/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/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/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.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 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
|
||||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
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/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
|
36
mdns.go
36
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 (
|
||||||
@ -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
|
||||||
@ -449,9 +448,9 @@ func (m *mdnsRegister) LookupService(ctx context.Context, service string, opts .
|
|||||||
|
|
||||||
p := util.DefaultParams(service)
|
p := util.DefaultParams(service)
|
||||||
// set context with timeout
|
// set context with timeout
|
||||||
//var cancel context.CancelFunc
|
// var cancel context.CancelFunc
|
||||||
//p.Context, cancel = context.WithTimeout(context.Background(), m.opts.Timeout)
|
// p.Context, cancel = context.WithTimeout(context.Background(), m.opts.Timeout)
|
||||||
//defer cancel()
|
// defer cancel()
|
||||||
// set entries channel
|
// set entries channel
|
||||||
p.Entries = entries
|
p.Entries = entries
|
||||||
// set the domain
|
// set the domain
|
||||||
@ -506,7 +505,7 @@ func (m *mdnsRegister) LookupService(ctx context.Context, service string, opts .
|
|||||||
})
|
})
|
||||||
|
|
||||||
serviceMap[txt.Version] = s
|
serviceMap[txt.Version] = s
|
||||||
//case <-p.Context.Done():
|
// case <-p.Context.Done():
|
||||||
// close(done)
|
// close(done)
|
||||||
// return
|
// return
|
||||||
}
|
}
|
||||||
@ -550,9 +549,9 @@ func (m *mdnsRegister) ListServices(ctx context.Context, opts ...register.ListOp
|
|||||||
|
|
||||||
p := util.DefaultParams("_services")
|
p := util.DefaultParams("_services")
|
||||||
// set context with timeout
|
// set context with timeout
|
||||||
//var cancel context.CancelFunc
|
// var cancel context.CancelFunc
|
||||||
//p.Context, cancel = context.WithTimeout(context.Background(), m.opts.Timeout)
|
// p.Context, cancel = context.WithTimeout(context.Background(), m.opts.Timeout)
|
||||||
//defer cancel()
|
// defer cancel()
|
||||||
// set entries channel
|
// set entries channel
|
||||||
p.Entries = entries
|
p.Entries = entries
|
||||||
// set domain
|
// set domain
|
||||||
@ -575,9 +574,9 @@ func (m *mdnsRegister) ListServices(ctx context.Context, opts ...register.ListOp
|
|||||||
serviceMap[name] = true
|
serviceMap[name] = true
|
||||||
services = append(services, ®ister.Service{Name: name})
|
services = append(services, ®ister.Service{Name: name})
|
||||||
}
|
}
|
||||||
//case <-p.Context.Done():
|
// case <-p.Context.Done():
|
||||||
// close(done)
|
// close(done)
|
||||||
//return
|
// return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@ -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
|
||||||
|
45
mdns_test.go
45
mdns_test.go
@ -6,7 +6,7 @@ import (
|
|||||||
"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) {
|
||||||
@ -23,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",
|
||||||
@ -36,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",
|
||||||
@ -49,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",
|
||||||
@ -100,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 {
|
||||||
@ -139,7 +139,6 @@ func TestMDNS(t *testing.T) {
|
|||||||
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) {
|
||||||
@ -149,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",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,17 +172,12 @@ 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) {
|
||||||
@ -215,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",
|
||||||
@ -228,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",
|
||||||
@ -241,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",
|
||||||
@ -254,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 {
|
||||||
@ -271,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 {
|
||||||
|
@ -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"
|
||||||
@ -311,7 +311,7 @@ func (c *client) query(ctx context.Context, params *QueryParam) error {
|
|||||||
// buf := make([]byte, 2, 514)
|
// buf := make([]byte, 2, 514)
|
||||||
hdr := dnsmessage.Header{RecursionDesired: false}
|
hdr := dnsmessage.Header{RecursionDesired: false}
|
||||||
b := dnsmessage.NewBuilder(nil, hdr)
|
b := dnsmessage.NewBuilder(nil, hdr)
|
||||||
//b.EnableCompression()
|
// b.EnableCompression()
|
||||||
name, err := dnsmessage.NewName(serviceAddr)
|
name, err := dnsmessage.NewName(serviceAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -322,7 +322,7 @@ func (c *client) query(ctx context.Context, params *QueryParam) error {
|
|||||||
} else {
|
} else {
|
||||||
q.Type = params.Type
|
q.Type = params.Type
|
||||||
}
|
}
|
||||||
//q.Class |= 1 << 15
|
// q.Class |= 1 << 15
|
||||||
if err = b.StartQuestions(); err != nil {
|
if err = b.StartQuestions(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -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"
|
||||||
@ -139,8 +139,8 @@ func NewServer(config *Config) (*Server, error) {
|
|||||||
go s.recv(s.ipv6conn)
|
go s.recv(s.ipv6conn)
|
||||||
|
|
||||||
go s.update()
|
go s.update()
|
||||||
//s.wg.Add(1)
|
// s.wg.Add(1)
|
||||||
//go s.probe()
|
// go s.probe()
|
||||||
|
|
||||||
return s, nil
|
return s, nil
|
||||||
}
|
}
|
||||||
@ -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 (
|
||||||
|
Loading…
Reference in New Issue
Block a user