New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OSPP] EdgeMesh supports high availability architecture Design and Implementation #372
Conversation
Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: NKDYX <2374087322@qq.com>
Signed-off-by: NKDYX <2374087322@qq.com>
Signed-off-by: NKDYX <2374087322@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
…p-circuit Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
…nodes Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: NKDYX <2374087322@qq.com>
Signed-off-by: NKDYX <2374087322@qq.com>
Signed-off-by: NKDYX <2374087322@qq.com>
Signed-off-by: NKDYX <2374087322@qq.com>
Signed-off-by: NKDYX <2374087322@qq.com>
Signed-off-by: NKDYX <2374087322@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
…cture Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
Signed-off-by: Poorunga <2744323@qq.com>
32b2b50
to
17336dc
Compare
pkg/tunnel/util_test.go
Outdated
|
||
import ( | ||
"fmt" | ||
"github.com/libp2p/go-libp2p-core/peer" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the import order recommended by go, please import in the following order:
- built-in packages
- third-party packages
- this project packages
pkg/tunnel/util_test.go
Outdated
"testing" | ||
) | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/**/ is not the function comment method recommended by go, please replace it with //
pkg/tunnel/util_test.go
Outdated
|
||
} | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/**/ is not the structure comment method recommended by go, please replace it with //, and comments and code are not related.
} | ||
|
||
func TestAddCircuitAddrsToPeer(t *testing.T) { | ||
want := "{12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg: [/ip4/5.5.5.5/tcp/9000/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg /ip4/5.5.5.5/udp/9000/quic/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg /ip4/5.5.5.5/tcp/9000/p2p/12D3KooWB5qVCMrMNLpBDfMu6o4dy6ci2UqDVsFVomcd2PfYVzfW/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/5.5.5.5/udp/9000/quic/p2p/12D3KooWB5qVCMrMNLpBDfMu6o4dy6ci2UqDVsFVomcd2PfYVzfW/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/6.6.6.6/tcp/9000/p2p/12D3KooWErZ4m27CEinjcnXNvem2KFUJUFRBcd9NdcWnYRqyr1Sn/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/6.6.6.6/udp/9000/quic/p2p/12D3KooWErZ4m27CEinjcnXNvem2KFUJUFRBcd9NdcWnYRqyr1Sn/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/4.4.4.4/tcp/9000/p2p/12D3KooWSD4f5fZb5c9PQ6FPVd8Em4eKX3mRezcyqXSHUyomoy8S/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/4.4.4.4/udp/9000/quic/p2p/12D3KooWSD4f5fZb5c9PQ6FPVd8Em4eKX3mRezcyqXSHUyomoy8S/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/8.8.8.8/tcp/9000/p2p/12D3KooWF3RB8SoMRZht7MDqF6GoipSPdFxVb9ESRLU7NuPX6ifH/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/8.8.8.8/udp/9000/quic/p2p/12D3KooWF3RB8SoMRZht7MDqF6GoipSPdFxVb9ESRLU7NuPX6ifH/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/5.5.5.5/tcp/9000/p2p/12D3KooWB5qVCMrMNLpBDfMu6o4dy6ci2UqDVsFVomcd2PfYVzfW/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/5.5.5.5/udp/9000/quic/p2p/12D3KooWB5qVCMrMNLpBDfMu6o4dy6ci2UqDVsFVomcd2PfYVzfW/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/6.6.6.6/tcp/9000/p2p/12D3KooWErZ4m27CEinjcnXNvem2KFUJUFRBcd9NdcWnYRqyr1Sn/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/6.6.6.6/udp/9000/quic/p2p/12D3KooWErZ4m27CEinjcnXNvem2KFUJUFRBcd9NdcWnYRqyr1Sn/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/4.4.4.4/tcp/9000/p2p/12D3KooWSD4f5fZb5c9PQ6FPVd8Em4eKX3mRezcyqXSHUyomoy8S/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/4.4.4.4/udp/9000/quic/p2p/12D3KooWSD4f5fZb5c9PQ6FPVd8Em4eKX3mRezcyqXSHUyomoy8S/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/8.8.8.8/tcp/9000/p2p/12D3KooWF3RB8SoMRZht7MDqF6GoipSPdFxVb9ESRLU7NuPX6ifH/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/8.8.8.8/udp/9000/quic/p2p/12D3KooWF3RB8SoMRZht7MDqF6GoipSPdFxVb9ESRLU7NuPX6ifH/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A too long code, It is recommended to read this data from a file.
} | ||
//test AddCircuitAddrsToPeer | ||
AddCircuitAddrsToPeer(&relayPeer, relayList) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this err is not return by AddCircuitAddrsToPeer(&relayPeer, relayList)
pkg/tunnel/util_test.go
Outdated
func TestAddCircuitAddrsToPeer(t *testing.T) { | ||
want := "{12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg: [/ip4/5.5.5.5/tcp/9000/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg /ip4/5.5.5.5/udp/9000/quic/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg /ip4/5.5.5.5/tcp/9000/p2p/12D3KooWB5qVCMrMNLpBDfMu6o4dy6ci2UqDVsFVomcd2PfYVzfW/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/5.5.5.5/udp/9000/quic/p2p/12D3KooWB5qVCMrMNLpBDfMu6o4dy6ci2UqDVsFVomcd2PfYVzfW/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/6.6.6.6/tcp/9000/p2p/12D3KooWErZ4m27CEinjcnXNvem2KFUJUFRBcd9NdcWnYRqyr1Sn/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/6.6.6.6/udp/9000/quic/p2p/12D3KooWErZ4m27CEinjcnXNvem2KFUJUFRBcd9NdcWnYRqyr1Sn/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/4.4.4.4/tcp/9000/p2p/12D3KooWSD4f5fZb5c9PQ6FPVd8Em4eKX3mRezcyqXSHUyomoy8S/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/4.4.4.4/udp/9000/quic/p2p/12D3KooWSD4f5fZb5c9PQ6FPVd8Em4eKX3mRezcyqXSHUyomoy8S/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/8.8.8.8/tcp/9000/p2p/12D3KooWF3RB8SoMRZht7MDqF6GoipSPdFxVb9ESRLU7NuPX6ifH/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/8.8.8.8/udp/9000/quic/p2p/12D3KooWF3RB8SoMRZht7MDqF6GoipSPdFxVb9ESRLU7NuPX6ifH/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/5.5.5.5/tcp/9000/p2p/12D3KooWB5qVCMrMNLpBDfMu6o4dy6ci2UqDVsFVomcd2PfYVzfW/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/5.5.5.5/udp/9000/quic/p2p/12D3KooWB5qVCMrMNLpBDfMu6o4dy6ci2UqDVsFVomcd2PfYVzfW/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/6.6.6.6/tcp/9000/p2p/12D3KooWErZ4m27CEinjcnXNvem2KFUJUFRBcd9NdcWnYRqyr1Sn/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/6.6.6.6/udp/9000/quic/p2p/12D3KooWErZ4m27CEinjcnXNvem2KFUJUFRBcd9NdcWnYRqyr1Sn/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/4.4.4.4/tcp/9000/p2p/12D3KooWSD4f5fZb5c9PQ6FPVd8Em4eKX3mRezcyqXSHUyomoy8S/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/4.4.4.4/udp/9000/quic/p2p/12D3KooWSD4f5fZb5c9PQ6FPVd8Em4eKX3mRezcyqXSHUyomoy8S/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/8.8.8.8/tcp/9000/p2p/12D3KooWF3RB8SoMRZht7MDqF6GoipSPdFxVb9ESRLU7NuPX6ifH/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit /ip4/8.8.8.8/udp/9000/quic/p2p/12D3KooWF3RB8SoMRZht7MDqF6GoipSPdFxVb9ESRLU7NuPX6ifH/p2p/12D3KooWQ4LGgA3djuvPt4Ao9YH2U39Yge5uzn3HwHXkDK23YDVg/p2p-circuit]}" | ||
//节点列表 | ||
var Nodes = []*testNode{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using exported variables inside functions is bad
pkg/tunnel/util_test.go
Outdated
} | ||
|
||
func TestAppendMultiaddrs(t *testing.T) { | ||
//want := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete useless comments
pkg/tunnel/util_test.go
Outdated
} | ||
|
||
func BenchmarkAddCircuitAddrsToPeer(b *testing.B) { | ||
//节点列表 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use English comments
pkg/tunnel/util_test.go
Outdated
b.Errorf("AddAddress failed, err:%v", err) | ||
} | ||
b.Logf(relayPeer.String()) | ||
//b.Logf("the final got : %s", relayPeer.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete useless comments
pkg/tunnel/util_test.go
Outdated
|
||
// generate relayNode | ||
priv, err := GenerateKeyPairWithString("MyNode") | ||
assertEqualB(err, nil, b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have to use assertions in benchmark tests. How the function returns an error, just terminate the benchmark test directly.
pkg/tunnel/util_test.go
Outdated
assertEqual(err, nil, t) | ||
out, err := peer.IDFromPrivateKey(key) | ||
assertEqual(err, nil, t) | ||
if ans := peer.Encode(out); !assertEqual(ans, c.wanted, t) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use expired functions: peer.Encode
pkg/tunnel/util_test.go
Outdated
return true | ||
} | ||
|
||
func assertTrue(t *testing.T, a bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete useless functions
pkg/tunnel/util_test.go
Outdated
key, err := GenerateKeyPairWithString(given) | ||
b.StopTimer() | ||
assertEqualB(err, nil, b) | ||
out, err := peer.IDFromPrivateKey(key) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to benchmark test, you must test a lot, refer to:
for i := 0; i < b.N; i++ {
_, err = peer.IDFromPrivateKey(key)
if err != nil {
b.Fatal(err)
}
}
Signed-off-by: NKDYX <2374087322@qq.com>
Signed-off-by: NKDYX <2374087322@qq.com>
7941d99
to
625ec48
Compare
Signed-off-by: NKDYX <2374087322@qq.com>
Signed-off-by: NKDYX <2374087322@qq.com>
/lgtm |
@khalid-huang: changing LGTM is restricted to collaborators In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: khalid-jobs The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
#353
#362
What this PR does / why we need it:
[OSPP] Code for EdgeMesh supports high availability architecture Design and Implementation
Main part of OSPP high availability (ha) feature. In this project we combined edgemesh-server and edgemesh-agent into a new structure--EdgeTunnel, which helps to relay and hole punch. The project contains new functions like Boostrap-Connection、mDNS-Discovery 、DHT-Discovery 、Relay-HeartBeat etc.