From ca7565c7c866916c636a8f39e6e0a18288ea9b39 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Wed, 27 Oct 2021 23:49:50 +0300 Subject: [PATCH] update import paths Signed-off-by: Vasiliy Tolstov --- .github/workflows/codeql-analysis.yml | 21 +++--- .github/workflows/dependabot-automerge.yml | 75 ++++++---------------- go.mod | 8 +-- go.sum | 35 ++++------ mdns.go | 36 ++++++----- mdns_test.go | 45 ++++--------- options.go | 2 +- util/client.go | 7 +- util/server.go | 9 ++- util/server_test.go | 2 +- 10 files changed, 86 insertions(+), 154 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index fa4081e..b50aad2 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -9,7 +9,7 @@ # the `language` matrix defined below to confirm you have the correct set of # supported CodeQL languages. # -name: "CodeQL" +name: "codeql" on: workflow_run: @@ -17,16 +17,16 @@ on: types: - completed push: - branches: [ master ] + branches: [ master, v3 ] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [ master, v3 ] schedule: - cron: '34 1 * * 0' jobs: analyze: - name: Analyze + name: analyze runs-on: ubuntu-latest permissions: 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 steps: - - name: Checkout repository + - 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: Initialize CodeQL + - name: init uses: github/codeql-action/init@v1 with: languages: ${{ matrix.language }} @@ -57,7 +60,7 @@ jobs: # 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 + - name: autobuild uses: github/codeql-action/autobuild@v1 # ℹ️ Command-line programs to run using the OS shell. @@ -71,5 +74,5 @@ jobs: # make bootstrap # make release - - name: Perform CodeQL Analysis + - name: analyze uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml index 9715c32..69e4c39 100644 --- a/.github/workflows/dependabot-automerge.yml +++ b/.github/workflows/dependabot-automerge.yml @@ -1,66 +1,31 @@ name: "prautomerge" on: - workflow_run: - workflows: ["prbuild"] - types: - - completed + pull_request_target: + types: [assigned, opened, synchronize, reopened] permissions: - contents: write pull-requests: write + contents: write jobs: - Dependabot-Automerge: + dependabot: runs-on: ubuntu-latest - # Contains workaround to execute if dependabot updates the PR by checking for the base branch in the linked PR - # 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 )) + if: ${{ github.actor == 'dependabot[bot]' }} steps: - - name: Approve Changes and Merge changes if label 'dependencies' is set - uses: actions/github-script@v4 + - name: metadata + id: metadata + uses: dependabot/fetch-metadata@v1.1.1 with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - console.log(context.payload.workflow_run); - - var labelNames = await github.paginate( - github.issues.listLabelsOnIssue, - { - repo: context.repo.repo, - owner: context.repo.owner, - issue_number: context.payload.workflow_run.pull_requests[0].number, - }, - (response) => response.data.map( - (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'); - } + 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}} diff --git a/go.mod b/go.mod index f260b59..bc249b8 100644 --- a/go.mod +++ b/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 require ( - github.com/google/uuid v1.3.0 github.com/miekg/dns v1.1.43 - github.com/unistack-org/micro/v3 v3.7.1 - golang.org/x/net v0.0.0-20210525063256-abc453219eb5 - golang.org/x/sys v0.0.0-20210603125802-9665404d3644 // indirect + go.unistack.org/micro/v3 v3.8.7 + golang.org/x/net v0.0.0-20211020060615-d418f374d309 ) diff --git a/go.sum b/go.sum index d0965a9..1f85647 100644 --- a/go.sum +++ b/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/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/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/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/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/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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/silas/dag v0.0.0-20210121180416-41cf55125c34/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -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= +github.com/silas/dag v0.0.0-20210626123444-3804bac2d6d4/go.mod h1:7RTUFBdIRC9nZ7/3RyRNH1bdqIShrDejd1YbLwgPS+I= +go.unistack.org/micro-proto/v3 v3.1.0 h1:q39FwjFiRZn+Ux/tt+d3bJTmDtsQQWa+3SLYVo1vLfA= +go.unistack.org/micro-proto/v3 v3.1.0/go.mod h1:DpRhYCBXlmSJ/AAXTmntvlh7kQkYU6eFvlmYAx4BQS8= +go.unistack.org/micro/v3 v3.8.7 h1:k1zOpJ3uS8MxdhK8annRsa5J/LW7MpqPjwYuekW61wE= +go.unistack.org/micro/v3 v3.8.7/go.mod h1:KMMmOmbgo/D52/rCAbqeKbBsgEEbSKM69he54J3ZIuA= 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-20210525063256-abc453219eb5 h1:wjuX4b5yYQnEQHzd+CBcrcC6OVR2J1CN6mUy0oSxIPo= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211020060615-d418f374d309 h1:A0lJIi+hcTR6aajJH4YqKWwohY4aW9RO7oRMcdv+HKI= +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/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-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-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/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/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-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/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= diff --git a/mdns.go b/mdns.go index a163200..57d6a01 100644 --- a/mdns.go +++ b/mdns.go @@ -1,4 +1,4 @@ -package mdns +package mdns // import "go.unistack.org/micro-register-mdns/v3" import ( "bytes" @@ -14,10 +14,10 @@ import ( "sync" "time" - "github.com/google/uuid" - util "github.com/unistack-org/micro-register-mdns/v3/util" - "github.com/unistack-org/micro/v3/logger" - "github.com/unistack-org/micro/v3/register" + util "go.unistack.org/micro-register-mdns/v3/util" + "go.unistack.org/micro/v3/logger" + "go.unistack.org/micro/v3/register" + "go.unistack.org/micro/v3/util/id" ) const ( @@ -251,7 +251,6 @@ func registerService(service *register.Service, entries []*mdnsEntry, options re Endpoints: service.Endpoints, Metadata: node.Metadata, }) - if err != nil { lastError = err continue @@ -449,9 +448,9 @@ func (m *mdnsRegister) LookupService(ctx context.Context, service string, opts . p := util.DefaultParams(service) // set context with timeout - //var cancel context.CancelFunc - //p.Context, cancel = context.WithTimeout(context.Background(), m.opts.Timeout) - //defer cancel() + // var cancel context.CancelFunc + // p.Context, cancel = context.WithTimeout(context.Background(), m.opts.Timeout) + // defer cancel() // set entries channel p.Entries = entries // set the domain @@ -506,7 +505,7 @@ func (m *mdnsRegister) LookupService(ctx context.Context, service string, opts . }) serviceMap[txt.Version] = s - //case <-p.Context.Done(): + // case <-p.Context.Done(): // close(done) // return } @@ -550,9 +549,9 @@ func (m *mdnsRegister) ListServices(ctx context.Context, opts ...register.ListOp p := util.DefaultParams("_services") // set context with timeout - //var cancel context.CancelFunc - //p.Context, cancel = context.WithTimeout(context.Background(), m.opts.Timeout) - //defer cancel() + // var cancel context.CancelFunc + // p.Context, cancel = context.WithTimeout(context.Background(), m.opts.Timeout) + // defer cancel() // set entries channel p.Entries = entries // set domain @@ -575,9 +574,9 @@ func (m *mdnsRegister) ListServices(ctx context.Context, opts ...register.ListOp serviceMap[name] = true services = append(services, ®ister.Service{Name: name}) } - //case <-p.Context.Done(): + // case <-p.Context.Done(): // close(done) - //return + // return } } }() @@ -606,13 +605,17 @@ func (m *mdnsRegister) Watch(ctx context.Context, opts ...register.WatchOption) } md := &mdnsWatcher{ - id: uuid.New().String(), wo: wo, ch: make(chan *util.ServiceEntry, 32), exit: make(chan struct{}), domain: wo.Domain, registry: m, } + id, err := id.New() + if err != nil { + return nil, err + } + md.id = id m.mtx.Lock() defer m.mtx.Unlock() @@ -676,7 +679,6 @@ func (m *mdnsRegister) Watch(ctx context.Context, opts ...register.WatchOption) m.mtx.RUnlock() } } - }() // start listening, blocking call diff --git a/mdns_test.go b/mdns_test.go index 5509203..feea768 100644 --- a/mdns_test.go +++ b/mdns_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/unistack-org/micro/v3/register" + "go.unistack.org/micro/v3/register" ) func TestMDNS(t *testing.T) { @@ -23,7 +23,7 @@ func TestMDNS(t *testing.T) { Version: "1.0.1", Nodes: []*register.Node{ { - Id: "test1-1", + ID: "test1-1", Address: "10.0.0.1:10001", Metadata: map[string]string{ "foo": "bar", @@ -36,7 +36,7 @@ func TestMDNS(t *testing.T) { Version: "1.0.2", Nodes: []*register.Node{ { - Id: "test2-1", + ID: "test2-1", Address: "10.0.0.2:10002", Metadata: map[string]string{ "foo2": "bar2", @@ -49,7 +49,7 @@ func TestMDNS(t *testing.T) { Version: "1.0.3", Nodes: []*register.Node{ { - Id: "test3-1", + ID: "test3-1", Address: "10.0.0.3:10003", Metadata: map[string]string{ "foo3": "bar3", @@ -100,8 +100,8 @@ func TestMDNS(t *testing.T) { node := s[0].Nodes[0] - if node.Id != service.Nodes[0].Id { - t.Fatalf("Expected node id %s got %s", service.Nodes[0].Id, node.Id) + if node.ID != service.Nodes[0].ID { + t.Fatalf("Expected node id %s got %s", service.Nodes[0].ID, node.ID) } if node.Address != service.Nodes[0].Address { @@ -139,7 +139,6 @@ func TestMDNS(t *testing.T) { t.Fatalf("Expected nothing got %+v", s[0]) } } - } func TestEncoding(t *testing.T) { @@ -149,22 +148,6 @@ func TestEncoding(t *testing.T) { Metadata: map[string]string{ "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) } - 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 { if val := decoded.Metadata[k]; val != v { t.Fatalf("Expected %s=%s got %s=%s", k, v, k, val) } } } - } func TestWatcher(t *testing.T) { @@ -215,7 +193,7 @@ func TestWatcher(t *testing.T) { Version: "1.0.1", Nodes: []*register.Node{ { - Id: "test1-1", + ID: "test1-1", Address: "10.0.0.1:10001", Metadata: map[string]string{ "foo": "bar", @@ -228,7 +206,7 @@ func TestWatcher(t *testing.T) { Version: "1.0.2", Nodes: []*register.Node{ { - Id: "test2-1", + ID: "test2-1", Address: "10.0.0.2:10002", Metadata: map[string]string{ "foo2": "bar2", @@ -241,7 +219,7 @@ func TestWatcher(t *testing.T) { Version: "1.0.3", Nodes: []*register.Node{ { - Id: "test3-1", + ID: "test3-1", Address: "10.0.0.3:10003", Metadata: map[string]string{ "foo3": "bar3", @@ -254,7 +232,6 @@ func TestWatcher(t *testing.T) { testFn := func(service, s *register.Service) { if s == nil { t.Fatalf("Expected one result for %s got nil", service.Name) - } if s.Name != service.Name { @@ -271,8 +248,8 @@ func TestWatcher(t *testing.T) { node := s.Nodes[0] - if node.Id != service.Nodes[0].Id { - t.Fatalf("Expected node id %s got %s", service.Nodes[0].Id, node.Id) + if node.ID != service.Nodes[0].ID { + t.Fatalf("Expected node id %s got %s", service.Nodes[0].ID, node.ID) } if node.Address != service.Nodes[0].Address { diff --git a/options.go b/options.go index 0923297..0ecb914 100644 --- a/options.go +++ b/options.go @@ -4,7 +4,7 @@ package mdns import ( "context" - "github.com/unistack-org/micro/v3/register" + "go.unistack.org/micro/v3/register" ) // Domain sets the mdnsDomain diff --git a/util/client.go b/util/client.go index b948869..b6082a4 100644 --- a/util/client.go +++ b/util/client.go @@ -6,7 +6,7 @@ import ( "net" "sync" - "github.com/unistack-org/micro/v3/logger" + "go.unistack.org/micro/v3/logger" "golang.org/x/net/dns/dnsmessage" "golang.org/x/net/ipv4" "golang.org/x/net/ipv6" @@ -311,7 +311,7 @@ func (c *client) query(ctx context.Context, params *QueryParam) error { // buf := make([]byte, 2, 514) hdr := dnsmessage.Header{RecursionDesired: false} b := dnsmessage.NewBuilder(nil, hdr) - //b.EnableCompression() + // b.EnableCompression() name, err := dnsmessage.NewName(serviceAddr) if err != nil { return err @@ -322,7 +322,7 @@ func (c *client) query(ctx context.Context, params *QueryParam) error { } else { q.Type = params.Type } - //q.Class |= 1 << 15 + // q.Class |= 1 << 15 if err = b.StartQuestions(); err != nil { return err } @@ -381,7 +381,6 @@ func (c *client) query(ctx context.Context, params *QueryParam) error { return nil } } - } // sendQuery is used to multicast a query out diff --git a/util/server.go b/util/server.go index d6cf172..0a1f3e3 100644 --- a/util/server.go +++ b/util/server.go @@ -8,8 +8,8 @@ import ( "sync/atomic" "github.com/miekg/dns" - registry "github.com/unistack-org/micro/v3/register" - regutil "github.com/unistack-org/micro/v3/util/register" + registry "go.unistack.org/micro/v3/register" + regutil "go.unistack.org/micro/v3/util/register" "golang.org/x/net/dns/dnsmessage" "golang.org/x/net/ipv4" "golang.org/x/net/ipv6" @@ -139,8 +139,8 @@ func NewServer(config *Config) (*Server, error) { go s.recv(s.ipv6conn) go s.update() - //s.wg.Add(1) - //go s.probe() + // s.wg.Add(1) + // go s.probe() 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) { - return nil, nil } diff --git a/util/server_test.go b/util/server_test.go index 45dfe99..b7aa95c 100644 --- a/util/server_test.go +++ b/util/server_test.go @@ -5,7 +5,7 @@ package mdns import ( "testing" - registry "github.com/unistack-org/micro/v3/register" + registry "go.unistack.org/micro/v3/register" ) var (