Go frmt proj

This commit is contained in:
Aviv Eyal 2017-11-28 22:25:50 +02:00 committed by Steven Allen
parent 4b231df997
commit 8d6313d195
4 changed files with 14 additions and 14 deletions

View File

@ -8,9 +8,9 @@ import (
inet "gx/ipfs/QmbD5yKbXahNvoMqzeuNyKQA9vAs9fUvJg2GXeWU1fVqY5/go-libp2p-net"
p2p "github.com/avive/go-libp2p/examples/multipro/pb"
uuid "github.com/google/uuid"
"github.com/ipfs/go-ipfs/thirdparty/assert"
p2p "github.com/avive/go-libp2p/examples/multipro/pb"
protobufCodec "github.com/multiformats/go-multicodec/protobuf"
"gx/ipfs/QmRS46AyqtpJBsf1zmQdeizSDEzo1qkWR7rdEuPFAv8237/go-libp2p-host"
)
@ -51,7 +51,7 @@ func (e EchoProtocol) onEchoRequest(s inet.Stream) {
log.Println("Failed to authenticate message")
return
} else {
log.Println("Authenticated request content was generated by author node :-)")
//log.Println("Authenticated request content was generated by author node :-)")
}
log.Printf("%s: Sending echo response to %s. Message id: %s...", s.Conn().LocalPeer(), s.Conn().RemotePeer(), data.MessageData.Id)
@ -101,7 +101,7 @@ func (e EchoProtocol) onEchoResponse(s inet.Stream) {
log.Println("Failed to authenticate message")
return
} else {
log.Println("Authenticated response content generated by claimed node :-)")
//log.Println("Authenticated response content generated by claimed node :-)")
}
// locate request data and remove it if found

View File

@ -1,10 +1,10 @@
package main
import (
p2p "github.com/avive/go-libp2p/examples/multipro/pb"
"github.com/gogo/protobuf/proto"
host "gx/ipfs/QmRS46AyqtpJBsf1zmQdeizSDEzo1qkWR7rdEuPFAv8237/go-libp2p-host"
peer "gx/ipfs/QmXYjuNuxVzXKJCfWasQk1RqkhVLDM9jtUKhqc2WPQmFSB/go-libp2p-peer"
p2p "github.com/avive/go-libp2p/examples/multipro/pb"
"log"
)

View File

@ -8,8 +8,8 @@ import (
inet "gx/ipfs/QmbD5yKbXahNvoMqzeuNyKQA9vAs9fUvJg2GXeWU1fVqY5/go-libp2p-net"
uuid "github.com/google/uuid"
p2p "github.com/avive/go-libp2p/examples/multipro/pb"
uuid "github.com/google/uuid"
protobufCodec "github.com/multiformats/go-multicodec/protobuf"
"gx/ipfs/QmRS46AyqtpJBsf1zmQdeizSDEzo1qkWR7rdEuPFAv8237/go-libp2p-host"
)
@ -52,7 +52,7 @@ func (p PingProtocol) onPingRequest(s inet.Stream) {
log.Println("Failed to authenticate message")
return
} else {
log.Println("Authenticated request content was generated by claimed node :-)")
//log.Println("Authenticated request content was generated by claimed node :-)")
}
// generate response message
@ -100,7 +100,7 @@ func (p PingProtocol) onPingResponse(s inet.Stream) {
log.Println("Failed to authenticate message")
return
} else {
log.Println("Authenticated response content generated by claimed node :-)")
//log.Println("Authenticated response content generated by claimed node :-)")
}
// locate request data and remove it if found

View File

@ -3,12 +3,12 @@ package main
import (
"bufio"
p2p "github.com/avive/go-libp2p/examples/multipro/pb"
"github.com/gogo/protobuf/proto"
protobufCodec "github.com/multiformats/go-multicodec/protobuf"
"gx/ipfs/QmXYjuNuxVzXKJCfWasQk1RqkhVLDM9jtUKhqc2WPQmFSB/go-libp2p-peer"
inet "gx/ipfs/QmbD5yKbXahNvoMqzeuNyKQA9vAs9fUvJg2GXeWU1fVqY5/go-libp2p-net"
"log"
"time"
"github.com/gogo/protobuf/proto"
"gx/ipfs/QmXYjuNuxVzXKJCfWasQk1RqkhVLDM9jtUKhqc2WPQmFSB/go-libp2p-peer"
)
// node version
@ -33,7 +33,7 @@ func sendProtoMessage(data proto.Message, s inet.Stream) bool {
// messageId - unique for requests, copied from request for responses
func NewMessageData(node *Node, messageId string, gossip bool) *p2p.MessageData {
// this creates a protobuf data for a public key
// Create protobufs bin data for a public key
nodePubKey, err := node.Peerstore().PubKey(node.ID()).Bytes()
if err != nil {
@ -41,9 +41,9 @@ func NewMessageData(node *Node, messageId string, gossip bool) *p2p.MessageData
}
return &p2p.MessageData{ClientVersion: clientVersion,
NodeId: peer.IDB58Encode(node.ID()),
NodeId: peer.IDB58Encode(node.ID()),
NodePubKey: nodePubKey,
Timestamp: time.Now().Unix(),
Id: messageId,
Gossip: gossip}
Timestamp: time.Now().Unix(),
Id: messageId,
Gossip: gossip}
}