@@ -17,55 +17,14 @@ pub use p2p_connection_service::*;
1717
1818use serde:: { Deserialize , Serialize } ;
1919
20- use crate :: webrtc;
21-
22- #[ derive( Serialize , Deserialize , Eq , PartialEq , Debug , Clone , Copy , thiserror:: Error ) ]
23- pub enum RejectionReason {
24- #[ error( "peer_id does not match peer's public key" ) ]
25- PeerIdAndPublicKeyMismatch ,
26- #[ error( "target peer_id is not local node's peer_id" ) ]
27- TargetPeerIdNotMe ,
28- #[ error( "too many peers" ) ]
29- PeerCapacityFull ,
30- #[ error( "peer already connected" ) ]
31- AlreadyConnected ,
32- #[ error( "self connection detected" ) ]
33- ConnectingToSelf ,
34- }
35-
36- impl RejectionReason {
37- pub fn is_bad ( & self ) -> bool {
38- match self {
39- Self :: PeerIdAndPublicKeyMismatch => true ,
40- Self :: TargetPeerIdNotMe => true ,
41- Self :: PeerCapacityFull => false ,
42- Self :: AlreadyConnected => true ,
43- Self :: ConnectingToSelf => false ,
44- }
45- }
46- }
20+ pub use crate :: webrtc:: { Answer , Offer , P2pConnectionResponse , RejectionReason } ;
4721
4822#[ derive( Serialize , Deserialize , Debug , Clone , thiserror:: Error ) ]
4923pub enum P2pConnectionErrorResponse {
5024 #[ error( "connection rejected: {0}" ) ]
5125 Rejected ( RejectionReason ) ,
26+ #[ error( "signal decryption failed" ) ]
27+ SignalDecryptionFailed ,
5228 #[ error( "internal error" ) ]
5329 InternalError ,
5430}
55-
56- #[ derive( Serialize , Deserialize , Debug , Clone ) ]
57- pub enum P2pConnectionResponse {
58- Accepted ( Box < webrtc:: Answer > ) ,
59- Rejected ( RejectionReason ) ,
60- InternalError ,
61- }
62-
63- impl P2pConnectionResponse {
64- pub fn internal_error_str ( ) -> & ' static str {
65- "InternalError"
66- }
67-
68- pub fn internal_error_json_str ( ) -> & ' static str {
69- "\" InternalError\" "
70- }
71- }
0 commit comments