From 8a812f70e3de9b1784815f4141a014c275b1fb97 Mon Sep 17 00:00:00 2001 From: Karrenbelt Date: Wed, 13 Jul 2022 02:21:28 +0200 Subject: [PATCH 1/4] fix: aealite (port #2665) --- libs/go/aealite/connections/acn/acn.go | 422 ++++++++ libs/go/aealite/connections/acn/pipe_iface.go | 27 + libs/go/aealite/connections/acn/protocol.go | 30 + libs/go/aealite/connections/p2pclient.go | 165 ++-- libs/go/aealite/connections/tcpsocket.go | 52 +- libs/go/aealite/protocols/acn.pb.go | 834 ---------------- libs/go/aealite/protocols/acn.proto | 67 -- .../go/aealite/protocols/acn/v1_0_0/acn.pb.go | 912 ++++++++++++++++++ .../go/aealite/protocols/acn/v1_0_0/acn.proto | 73 ++ libs/go/aealite/protocols/acn/v1_0_0/acn.yaml | 64 ++ 10 files changed, 1664 insertions(+), 982 deletions(-) create mode 100644 libs/go/aealite/connections/acn/acn.go create mode 100644 libs/go/aealite/connections/acn/pipe_iface.go create mode 100644 libs/go/aealite/connections/acn/protocol.go delete mode 100644 libs/go/aealite/protocols/acn.pb.go delete mode 100644 libs/go/aealite/protocols/acn.proto create mode 100644 libs/go/aealite/protocols/acn/v1_0_0/acn.pb.go create mode 100644 libs/go/aealite/protocols/acn/v1_0_0/acn.proto create mode 100644 libs/go/aealite/protocols/acn/v1_0_0/acn.yaml diff --git a/libs/go/aealite/connections/acn/acn.go b/libs/go/aealite/connections/acn/acn.go new file mode 100644 index 0000000000..30cdc51733 --- /dev/null +++ b/libs/go/aealite/connections/acn/acn.go @@ -0,0 +1,422 @@ +/* -*- coding: utf-8 -*- +* ------------------------------------------------------------------------------ +* +* Copyright 2018-2021 Fetch.AI Limited +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* ------------------------------------------------------------------------------ + */ +package acn + +import ( + "errors" + "fmt" + "os" + "strings" + "time" + + "github.com/rs/zerolog" + proto "google.golang.org/protobuf/proto" +) + +var logger zerolog.Logger = zerolog.New(zerolog.ConsoleWriter{ + Out: os.Stdout, + NoColor: false, + TimeFormat: "15:04:05.000", +}). + With().Timestamp(). + Str("package", "AeaApiACN"). + Logger() + +func ignore(err error) { + if err != nil { + logger.Error().Str("err", err.Error()).Msgf("IGNORED: %s", err.Error()) + } +} + +type ACNError struct { + ErrorCode Status_ErrCode + Err error +} + +func (err *ACNError) Error() string { + return err.Err.Error() +} + +func DecodeAcnMessage(buf []byte) (string, *AeaEnvelopePerformative, *StatusBody, *ACNError) { + response := &AcnMessage{} + err := proto.Unmarshal(buf, response) + msg_type := "" + + if err != nil { + logger.Error().Str("err", err.Error()).Msgf("while decoding acn message") + return msg_type, nil, nil, &ACNError{ErrorCode: ERROR_DECODE, Err: err} + } + // response is either a LookupResponse or Status + var aeaEnvelope *AeaEnvelopePerformative = nil + var status *StatusBody = nil + + switch pl := response.Performative.(type) { + case *AeaEnvelope: + aeaEnvelope = pl.AeaEnvelope + msg_type = "aea_envelope" + case *Status: + status = pl.Status.Body + msg_type = "status" + default: + err = fmt.Errorf("unexpected ACN Message: %s", response) + logger.Error().Msg(err.Error()) + return msg_type, nil, nil, &ACNError{ErrorCode: ERROR_UNEXPECTED_PAYLOAD, Err: err} + } + return msg_type, aeaEnvelope, status, nil +} + +func WaitForStatus(ch chan *StatusBody, timeout time.Duration) (*StatusBody, error) { + select { + case m := <-ch: + return m, nil + case <-time.After(timeout): + err := errors.New("ACN send acknowledge timeout") + logger.Error().Msg(err.Error()) + return nil, err + } +} + +func SendAcnSuccess(pipe Pipe) error { + status := &StatusBody{Code: SUCCESS} + performative := &StatusPerformative{Body: status} + msg := &AcnMessage{ + Performative: &Status{Status: performative}, + } + buf, err := proto.Marshal(msg) + if err != nil { + logger.Error().Str("err", err.Error()).Msgf("error on encoding acn status message") + return err + } + err = pipe.Write(buf) + if err != nil { + logger.Error().Str("err", err.Error()).Msgf("error on sending acn status message") + + } + return err +} + +func SendAcnError(pipe Pipe, error_msg string, err_codes ...Status_ErrCode) error { + var err_code Status_ErrCode + + if len(err_codes) == 0 { + err_code = ERROR_GENERIC + } else { + err_code = err_codes[0] + } + + status := &StatusBody{Code: err_code, Msgs: []string{error_msg}} + msg := &AcnMessage{ + Performative: &Status{Status: &StatusPerformative{Body: status}}, + } + buf, err := proto.Marshal(msg) + if err != nil { + logger.Error().Str("err", err.Error()).Msgf("error on encoding acn status message") + return err + } + err = pipe.Write(buf) + if err != nil { + logger.Error().Str("err", err.Error()).Msgf("error on sending acn status message") + } + return err +} + +func EncodeAcnEnvelope(envelope_bytes []byte, record *AgentRecord) ([]byte, error) { + var performative *AeaEnvelopePerformative + if record != nil { + performative = &AeaEnvelopePerformative{Envelope: envelope_bytes, Record: record} + } else { + performative = &AeaEnvelopePerformative{Envelope: envelope_bytes} + } + + msg := &AcnMessage{ + Performative: &AeaEnvelope{AeaEnvelope: performative}, + } + + buf, err := proto.Marshal(msg) + if err != nil { + logger.Error(). + Str("err", err.Error()). + Msgf("while serializing envelope bytes: %s", envelope_bytes) + } + return buf, err +} + +type StatusQueue interface { + AddAcnStatusMessage(status *StatusBody, counterpartyID string) +} + +func ReadAgentRegistrationMessage(pipe Pipe) (*RegisterPerformative, error) { + var register *RegisterPerformative + buf, err := pipe.Read() + if err != nil { + logger.Error().Str("err", err.Error()).Msgf("while receiving agent's registration request") + return nil, err + } + + msg := &AcnMessage{} + err = proto.Unmarshal(buf, msg) + if err != nil { + logger.Error().Str("err", err.Error()).Msgf("couldn't deserialize acn registration message") + // TOFIX(LR) setting Msgs to err.Error is potentially a security vulnerability + acn_send_error := SendAcnError(pipe, err.Error(), ERROR_DECODE) + ignore(acn_send_error) + return nil, err + } + + switch pl := msg.Performative.(type) { + case *Register: + register = pl.Register + default: + err = errors.New("unexpected payload") + acn_send_error := SendAcnError(pipe, err.Error(), ERROR_UNEXPECTED_PAYLOAD) + ignore(acn_send_error) + return nil, err + } + return register, nil +} + +func SendEnvelopeMessageAndWaitForStatus( + pipe Pipe, + envelope_bytes []byte, + acn_status_chan chan *StatusBody, + acnStatusTimeout time.Duration, +) error { + err := SendEnvelopeMessage(pipe, envelope_bytes, nil) + if err != nil { + return err + } + + status, err := WaitForStatus(acn_status_chan, acnStatusTimeout) + if err != nil { + logger.Error(). + Str("err", err.Error()). + Msgf("on envelope sent status wait") + return err + } + if status.Code != SUCCESS { + logger.Error(). + Str("op", "send_envelope"). + Msgf("acn confirmation status is not Status Success: %d.", status.Code) + return fmt.Errorf( + "send envelope: acn confirmation status is not Status Success: %d", + status.Code, + ) + } + return err + +} + +func ReadLookupRequest(pipe Pipe) (string, error) { + buf, err := pipe.Read() + + if err != nil { + logger.Error().Str("err", err.Error()).Msgf("while reading message from stream") + return "", err + } + + msg := &AcnMessage{} + err = proto.Unmarshal(buf, msg) + if err != nil { + logger.Error(). + Str("err", err.Error()). + Msgf("couldn't deserialize acn lookup request message") + // TOFIX(LR) setting Msgs to err.Error is potentially a security vulnerability + acn_send_error := SendAcnError(pipe, err.Error(), ERROR_DECODE) + ignore(acn_send_error) + return "", err + } + + // Get LookupRequest message + var lookupRequest *LookupRequestPerformative + switch pl := msg.Performative.(type) { + case *LookupRequest: + lookupRequest = pl.LookupRequest + default: + err = errors.New("unexpected payload") + acn_send_error := SendAcnError(pipe, err.Error(), ERROR_UNEXPECTED_PAYLOAD) + ignore(acn_send_error) + return "", err + } + + reqAddress := lookupRequest.AgentAddress + return reqAddress, nil +} + +func SendLookupRequest(pipe Pipe, address string) error { + lookupRequest := &LookupRequestPerformative{AgentAddress: address} + msg := &AcnMessage{ + Performative: &LookupRequest{LookupRequest: lookupRequest}, + } + buf, err := proto.Marshal(msg) + if err != nil { + return err + } + err = pipe.Write([]byte(buf)) + return err +} + +func ReadLookupResponse(pipe Pipe) (*AgentRecord, error) { + buf, err := pipe.Read() + if err != nil { + return nil, err + } + response := &AcnMessage{} + err = proto.Unmarshal(buf, response) + if err != nil { + return nil, err + } + var lookupResponse *LookupResponsePerformative = nil + var status *StatusPerformative = nil + switch pl := response.Performative.(type) { + case *LookupResponse: + lookupResponse = pl.LookupResponse + case *Status: + status = pl.Status + default: + err = errors.New("unexpected Acn Message") + logger.Error().Str("err", err.Error()).Msgf("couldn't deserialize acn lookup response message") + return nil, err + } + + if status != nil { + err = errors.New( + "Failed agent lookup response " + status.Body.Code.String() + " : " + strings.Join( + status.Body.Msgs, + ":", + ), + ) + return nil, err + } + return lookupResponse.Record, nil +} + +func SendLookupResponse(pipe Pipe, record *AgentRecord) error { + lookupResponse := &LookupResponsePerformative{Record: record} + response := &AcnMessage{ + Performative: &LookupResponse{LookupResponse: lookupResponse}, + } + buf, err := proto.Marshal(response) + if err != nil { + return err + } + err = pipe.Write(buf) + return err +} + +func SendEnvelopeMessage(pipe Pipe, envelope_bytes []byte, record *AgentRecord) error { + acnMsgBytes, err := EncodeAcnEnvelope(envelope_bytes, record) + if err != nil { + return err + } + err = pipe.Write(acnMsgBytes) + if err != nil { + logger.Error(). + Str("err", err.Error()). + Msgf("on pipe write") + return err + } + return nil +} + +func SendAgentRegisterMessage(pipe Pipe, agentRecord *AgentRecord) error { + registration := &RegisterPerformative{Record: agentRecord} + msg := &AcnMessage{ + Performative: &Register{Register: registration}, + } + buf, err := proto.Marshal(msg) + if err != nil { + return err + } + + err = pipe.Write(buf) + if err != nil { + return err + } + + status, err := ReadAcnStatus(pipe) + if err != nil { + return err + } + if status.Code != SUCCESS { + return errors.New("Registration failed: " + strings.Join(status.Msgs, ":")) + } + return nil +} + +func ReadAcnStatus(pipe Pipe) (*StatusBody, error) { + buf, err := pipe.Read() + if err != nil { + logger.Error(). + Str("err", err.Error()). + Msgf("on pipe read") + return nil, err + } + + response := &AcnMessage{} + err = proto.Unmarshal(buf, response) + if err != nil { + logger.Error(). + Str("err", err.Error()). + Msgf("on acn decode") + return nil, err + } + + // response is expected to be a Status + var status *StatusPerformative + switch pl := response.Performative.(type) { + case *Status: + status = pl.Status + default: + err = errors.New("unexpected Acn Message") + return nil, err + } + + return status.Body, nil +} + +func ReadEnvelopeMessage(pipe Pipe) (*AeaEnvelopePerformative, error) { + buf, err := pipe.Read() + if err != nil { + return nil, err + } + messageType, envelope, _, acnErr := DecodeAcnMessage(buf) + + if acnErr != nil { + err = SendAcnError( + pipe, + acnErr.Error(), + acnErr.ErrorCode, + ) + ignore(err) + return nil, acnErr.Err + } + if messageType != "aea_envelope" { + return nil, errors.New("unexpected payload for acn message") + } + return envelope, nil +} + +func PerformAddressLookup(pipe Pipe, address string) (*AgentRecord, error) { + err := SendLookupRequest(pipe, address) + if err != nil { + return nil, err + } + return ReadLookupResponse(pipe) +} diff --git a/libs/go/aealite/connections/acn/pipe_iface.go b/libs/go/aealite/connections/acn/pipe_iface.go new file mode 100644 index 0000000000..7479f8966c --- /dev/null +++ b/libs/go/aealite/connections/acn/pipe_iface.go @@ -0,0 +1,27 @@ +/* -*- coding: utf-8 -*- +* ------------------------------------------------------------------------------ +* +* Copyright 2018-2021 Fetch.AI Limited +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* ------------------------------------------------------------------------------ + */ +package acn + +type Pipe interface { + Connect() error + Read() ([]byte, error) + Write(data []byte) error + //Close() error +} diff --git a/libs/go/aealite/connections/acn/protocol.go b/libs/go/aealite/connections/acn/protocol.go new file mode 100644 index 0000000000..5e1e2a3e38 --- /dev/null +++ b/libs/go/aealite/connections/acn/protocol.go @@ -0,0 +1,30 @@ +package acn + +import acn_protocol "aealite/protocols/acn/v1_0_0" + +type StatusBody = acn_protocol.AcnMessage_StatusBody +type AgentRecord = acn_protocol.AcnMessage_AgentRecord +type AcnMessage = acn_protocol.AcnMessage +type LookupRequest = acn_protocol.AcnMessage_LookupRequest +type LookupResponse = acn_protocol.AcnMessage_LookupResponse +type Status = acn_protocol.AcnMessage_Status +type LookupRequestPerformative = acn_protocol.AcnMessage_Lookup_Request_Performative +type LookupResponsePerformative = acn_protocol.AcnMessage_Lookup_Response_Performative +type StatusPerformative = acn_protocol.AcnMessage_Status_Performative +type RegisterPerformative = acn_protocol.AcnMessage_Register_Performative +type Register = acn_protocol.AcnMessage_Register +type AeaEnvelope = acn_protocol.AcnMessage_AeaEnvelope +type AeaEnvelopePerformative = acn_protocol.AcnMessage_Aea_Envelope_Performative + +const ERROR_DECODE = acn_protocol.AcnMessage_StatusBody_ERROR_DECODE +const SUCCESS = acn_protocol.AcnMessage_StatusBody_SUCCESS +const ERROR_UNEXPECTED_PAYLOAD = acn_protocol.AcnMessage_StatusBody_ERROR_UNEXPECTED_PAYLOAD +const ERROR_AGENT_NOT_READY = acn_protocol.AcnMessage_StatusBody_ERROR_AGENT_NOT_READY +const ERROR_UNKNOWN_AGENT_ADDRESS = acn_protocol.AcnMessage_StatusBody_ERROR_UNKNOWN_AGENT_ADDRESS +const ERROR_GENERIC = acn_protocol.AcnMessage_StatusBody_ERROR_GENERIC +const ERROR_WRONG_AGENT_ADDRESS = acn_protocol.AcnMessage_StatusBody_ERROR_WRONG_AGENT_ADDRESS +const ERROR_UNSUPPORTED_LEDGER = acn_protocol.AcnMessage_StatusBody_ERROR_UNSUPPORTED_LEDGER +const ERROR_WRONG_PUBLIC_KEY = acn_protocol.AcnMessage_StatusBody_ERROR_WRONG_PUBLIC_KEY +const ERROR_INVALID_PROOF = acn_protocol.AcnMessage_StatusBody_ERROR_INVALID_PROOF + +type Status_ErrCode = acn_protocol.AcnMessage_StatusBody_StatusCodeEnum diff --git a/libs/go/aealite/connections/p2pclient.go b/libs/go/aealite/connections/p2pclient.go index 4a6baf470e..3e0e16fdb3 100644 --- a/libs/go/aealite/connections/p2pclient.go +++ b/libs/go/aealite/connections/p2pclient.go @@ -35,12 +35,15 @@ import ( protocols "aealite/protocols" wallet "aealite/wallet" + acn "aealite/connections/acn" + "github.com/joho/godotenv" "github.com/rs/zerolog" proto "google.golang.org/protobuf/proto" ) const retryAttempts = 5 +const acnStatusTimeout = 5 * time.Second var logger zerolog.Logger = zerolog.New(zerolog.ConsoleWriter{ Out: os.Stdout, @@ -70,7 +73,7 @@ type P2PClientConfig struct { type P2PClientApi struct { clientConfig *P2PClientConfig - agentRecord *protocols.AgentRecord + agentRecord *acn.AgentRecord socket Socket outQueue chan *protocols.Envelope @@ -78,6 +81,8 @@ type P2PClientApi struct { closing bool connected bool initialised bool + + acn_status_chan chan *acn.StatusBody } func (client *P2PClientApi) InitFromEnv(envFile string) error { @@ -96,7 +101,7 @@ func (client *P2PClientApi) InitFromEnv(envFile string) error { } address := os.Getenv("AEA_ADDRESS") publicKey := os.Getenv("AEA_PUBLIC_KEY") - agentRecord := &protocols.AgentRecord{Address: address, PublicKey: publicKey} + agentRecord := &acn.AgentRecord{Address: address, PublicKey: publicKey} agentRecord.ServiceId = os.Getenv("AEA_P2P_POR_SERVICE_ID") agentRecord.LedgerId = os.Getenv("AEA_P2P_POR_LEDGER_ID") agentRecord.PeerPublicKey = os.Getenv("AEA_P2P_POR_PEER_PUBKEY") @@ -122,13 +127,20 @@ func (client *P2PClientApi) InitFromEnv(envFile string) error { } client.clientConfig = &P2PClientConfig{host: host, port: uint16(portConv)} - client.socket = NewSocket(client.clientConfig.host, client.clientConfig.port) + client.socket = NewSocket(client.clientConfig.host, client.clientConfig.port, client.agentRecord.PeerPublicKey) client.initialised = true return nil } func (client *P2PClientApi) Put(envelope *protocols.Envelope) error { - return writeEnvelope(client.socket, envelope) + + envelopeBytes, err := proto.Marshal(envelope) + if err != nil { + logger.Error().Str("err", err.Error()).Msgf("while serializing envelope: %s", envelope) + return err + } + return acn.SendEnvelopeMessageAndWaitForStatus(client.socket, envelopeBytes, client.acn_status_chan, acnStatusTimeout) + } func (client *P2PClientApi) Get() *protocols.Envelope { @@ -156,6 +168,7 @@ func (client *P2PClientApi) Disconnect() error { return err } close(client.outQueue) + close(client.acn_status_chan) client.connected = false return nil } @@ -183,6 +196,7 @@ func (client *P2PClientApi) Connect() error { client.closing = false client.outQueue = make(chan *protocols.Envelope, 10) + client.acn_status_chan = make(chan *acn.StatusBody, 10) go client.listenForEnvelopes() logger.Info().Msg("connected to p2p node") @@ -242,60 +256,14 @@ func (client *P2PClientApi) registerWithRetry() error { } func (client *P2PClientApi) register() error { - registration := &protocols.Register{Record: client.agentRecord} - msg := &protocols.AcnMessage{ - Version: protocols.ACNProtocolVersion, - Payload: &protocols.AcnMessage_Register{Register: registration}, - } - - buf, err := proto.Marshal(msg) - if err != nil { - logger.Error().Str("err", err.Error()).Msgf("while serializing registration msg: %s", msg) - return err - } - err = client.socket.Write(buf) - if err != nil { - logger.Error().Str("err", err.Error()). - Msg("while writing register envelope") - return err - } - data, err := client.socket.Read() - if err != nil { - logger.Error().Str("err", err.Error()).Msg("while receiving data") - return err - } - response := &protocols.AcnMessage{} - err = proto.Unmarshal(data, response) - if err != nil { - logger.Error().Str("err", err.Error()).Msgf("while deserializing response msg") - return err - } - - // Get Status message - var status *protocols.Status - switch pl := response.Payload.(type) { - case *protocols.AcnMessage_Status: - status = pl.Status - default: - logger.Error().Str("err", err.Error()).Msgf("response not a status msg") - return err - } - - if status.Code != protocols.Status_SUCCESS { - errMsg := fmt.Sprintf( - "registration to peer failed: %s %s", - status.Code.String(), - strings.Join(status.Msgs, ":"), - ) - return errors.New(errMsg) - } - return nil + return acn.SendAgentRegisterMessage(client.socket, client.agentRecord) } func (client *P2PClientApi) listenForEnvelopes() { for { - envel, err := readEnvelope(client.socket) - if err != nil { + envel, err := client.HandleAcnMessageFromPipe() + + if err != nil && !client.closing { logger.Error().Str("err", err.Error()).Msg("while receiving envelope") logger.Info().Msg("disconnecting") if !client.closing { @@ -306,6 +274,10 @@ func (client *P2PClientApi) listenForEnvelopes() { } return } + if envel == nil { + // got acn status, not an envelope + continue + } if envel.To != client.agentRecord.Address { logger.Error(). Str("err", "To ("+envel.To+") must match registered address"). @@ -324,26 +296,6 @@ func (client *P2PClientApi) stop() error { return client.socket.Disconnect() } -func writeEnvelope(socket Socket, envelope *protocols.Envelope) error { - data, err := proto.Marshal(envelope) - if err != nil { - logger.Error().Str("err", err.Error()).Msgf("while serializing envelope: %s", envelope) - return err - } - return socket.Write(data) -} - -func readEnvelope(socket Socket) (*protocols.Envelope, error) { - envelope := &protocols.Envelope{} - data, err := socket.Read() - if err != nil { - logger.Error().Str("err", err.Error()).Msg("while receiving data") - return envelope, err - } - err = proto.Unmarshal(data, envelope) - return envelope, err -} - // Error type represents list of errors in retry type Error []error @@ -463,3 +415,68 @@ func BackOffDelay(n uint, _ error, config *Config) time.Duration { func RandomDelay(_ uint, _ error, config *Config) time.Duration { return time.Duration(rand.Int63n(int64(config.maxJitter))) } + +func (client *P2PClientApi) HandleAcnMessageFromPipe() (*protocols.Envelope, error) { + pipe := client.socket + envelope := &protocols.Envelope{} + var acn_err error + + data, err := pipe.Read() + + if err != nil { + + return nil, err + } + + msg_type, acn_envelope, status, acnErr := acn.DecodeAcnMessage(data) + + if acnErr != nil { + logger.Error().Str("err", acnErr.Error()).Msg("while handling acn message") + acn_err = acn.SendAcnError( + pipe, + acnErr.Error(), + acnErr.ErrorCode, + ) + if acn_err != nil { + logger.Error().Str("err", acn_err.Error()).Msg("on acn send error") + } + return envelope, acnErr + } + + switch msg_type { + case "aea_envelope": + { + err = proto.Unmarshal(acn_envelope.Envelope, envelope) + if err != nil { + logger.Error().Str("err", err.Error()).Msg("while decoding envelope") + acn_err = acn.SendAcnError( + pipe, + "error on decoding envelope", + acn.ERROR_DECODE, + ) + if acn_err != nil { + logger.Error().Str("err", acn_err.Error()).Msg("on acn send error") + } + return envelope, err + } + err = acn.SendAcnSuccess(pipe) + return envelope, err + + } + case "status": + { + logger.Debug().Msgf("got acn status %d", status.Code) + client.acn_status_chan <- status + return nil, nil + + } + default: + { + acn_err = acn.SendAcnError(pipe, "Unsupported ACN message") + if acn_err != nil { + logger.Error().Str("err", acn_err.Error()).Msg("on acn send error") + } + return nil, errors.New("unsupported ACN message") + } + } +} diff --git a/libs/go/aealite/connections/tcpsocket.go b/libs/go/aealite/connections/tcpsocket.go index aafc9f95fd..9a534b40b5 100644 --- a/libs/go/aealite/connections/tcpsocket.go +++ b/libs/go/aealite/connections/tcpsocket.go @@ -21,25 +21,63 @@ package connections import ( + wallet "aealite/wallet" + "crypto/ecdsa" + "crypto/elliptic" + "crypto/tls" + "crypto/x509" "encoding/binary" - "net" + "errors" "strconv" ) type TCPSocketChannel struct { - address string - port uint16 - conn net.Conn + address string + port uint16 + conn *tls.Conn + peerPublicKey string } func (sock *TCPSocketChannel) Connect() error { var err error - sock.conn, err = net.Dial("tcp", sock.address+":"+strconv.FormatInt(int64(sock.port), 10)) + conf := &tls.Config{ + InsecureSkipVerify: true, + } + + sock.conn, err = tls.Dial("tcp", sock.address+":"+strconv.FormatInt(int64(sock.port), 10), conf) + + if err != nil { + return err + } + + state := sock.conn.ConnectionState() + var cert *x509.Certificate + + for _, v := range state.PeerCertificates { + cert = v + } + pub := cert.PublicKey.(*ecdsa.PublicKey) + publicKeyBytes := elliptic.Marshal(pub.Curve, pub.X, pub.Y) + + signature, err := sock.Read() + logger.Debug().Msgf("got signature %d bytes", len(signature)) if err != nil { return err } + pubkey, err := wallet.PubKeyFromFetchAIPublicKey(sock.peerPublicKey) + if err != nil { + return err + } + ok, err := pubkey.Verify(publicKeyBytes, signature) + if err != nil { + return err + } + if !ok { + return errors.New("tls signature check failed") + + } return nil } @@ -70,6 +108,6 @@ func (sock *TCPSocketChannel) Disconnect() error { return sock.conn.Close() } -func NewSocket(address string, port uint16) Socket { - return &TCPSocketChannel{address: address, port: port} +func NewSocket(address string, port uint16, peerPublicKey string) Socket { + return &TCPSocketChannel{address: address, port: port, peerPublicKey: peerPublicKey} } diff --git a/libs/go/aealite/protocols/acn.pb.go b/libs/go/aealite/protocols/acn.pb.go deleted file mode 100644 index 3476590487..0000000000 --- a/libs/go/aealite/protocols/acn.pb.go +++ /dev/null @@ -1,834 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.25.0 -// protoc v3.11.4 -// source: acn.proto - -package protocols - -import ( - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type Status_ErrCode int32 - -const ( - // common (0x) - Status_SUCCESS Status_ErrCode = 0 - Status_ERROR_UNSUPPORTED_VERSION Status_ErrCode = 1 - Status_ERROR_UNEXPECTED_PAYLOAD Status_ErrCode = 2 - Status_ERROR_GENERIC Status_ErrCode = 3 - Status_ERROR_SERIALIZATION Status_ErrCode = 4 - // register (1x) - Status_ERROR_WRONG_AGENT_ADDRESS Status_ErrCode = 10 - Status_ERROR_WRONG_PUBLIC_KEY Status_ErrCode = 11 - Status_ERROR_INVALID_PROOF Status_ErrCode = 12 - Status_ERROR_UNSUPPORTED_LEDGER Status_ErrCode = 13 - // lookup & delivery (2x) - Status_ERROR_UNKNOWN_AGENT_ADDRESS Status_ErrCode = 20 - Status_ERROR_AGENT_NOT_READY Status_ErrCode = 21 -) - -// Enum value maps for Status_ErrCode. -var ( - Status_ErrCode_name = map[int32]string{ - 0: "SUCCESS", - 1: "ERROR_UNSUPPORTED_VERSION", - 2: "ERROR_UNEXPECTED_PAYLOAD", - 3: "ERROR_GENERIC", - 4: "ERROR_SERIALIZATION", - 10: "ERROR_WRONG_AGENT_ADDRESS", - 11: "ERROR_WRONG_PUBLIC_KEY", - 12: "ERROR_INVALID_PROOF", - 13: "ERROR_UNSUPPORTED_LEDGER", - 20: "ERROR_UNKNOWN_AGENT_ADDRESS", - 21: "ERROR_AGENT_NOT_READY", - } - Status_ErrCode_value = map[string]int32{ - "SUCCESS": 0, - "ERROR_UNSUPPORTED_VERSION": 1, - "ERROR_UNEXPECTED_PAYLOAD": 2, - "ERROR_GENERIC": 3, - "ERROR_SERIALIZATION": 4, - "ERROR_WRONG_AGENT_ADDRESS": 10, - "ERROR_WRONG_PUBLIC_KEY": 11, - "ERROR_INVALID_PROOF": 12, - "ERROR_UNSUPPORTED_LEDGER": 13, - "ERROR_UNKNOWN_AGENT_ADDRESS": 20, - "ERROR_AGENT_NOT_READY": 21, - } -) - -func (x Status_ErrCode) Enum() *Status_ErrCode { - p := new(Status_ErrCode) - *p = x - return p -} - -func (x Status_ErrCode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Status_ErrCode) Descriptor() protoreflect.EnumDescriptor { - return file_acn_proto_enumTypes[0].Descriptor() -} - -func (Status_ErrCode) Type() protoreflect.EnumType { - return &file_acn_proto_enumTypes[0] -} - -func (x Status_ErrCode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Status_ErrCode.Descriptor instead. -func (Status_ErrCode) EnumDescriptor() ([]byte, []int) { - return file_acn_proto_rawDescGZIP(), []int{5, 0} -} - -type AgentRecord struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` - LedgerId string `protobuf:"bytes,2,opt,name=ledger_id,json=ledgerId,proto3" json:"ledger_id,omitempty"` - Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` - PublicKey string `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - PeerPublicKey string `protobuf:"bytes,5,opt,name=peer_public_key,json=peerPublicKey,proto3" json:"peer_public_key,omitempty"` - Signature string `protobuf:"bytes,6,opt,name=signature,proto3" json:"signature,omitempty"` - NotBefore string `protobuf:"bytes,7,opt,name=not_before,json=notBefore,proto3" json:"not_before,omitempty"` - NotAfter string `protobuf:"bytes,8,opt,name=not_after,json=notAfter,proto3" json:"not_after,omitempty"` -} - -func (x *AgentRecord) Reset() { - *x = AgentRecord{} - if protoimpl.UnsafeEnabled { - mi := &file_acn_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AgentRecord) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AgentRecord) ProtoMessage() {} - -func (x *AgentRecord) ProtoReflect() protoreflect.Message { - mi := &file_acn_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AgentRecord.ProtoReflect.Descriptor instead. -func (*AgentRecord) Descriptor() ([]byte, []int) { - return file_acn_proto_rawDescGZIP(), []int{0} -} - -func (x *AgentRecord) GetServiceId() string { - if x != nil { - return x.ServiceId - } - return "" -} - -func (x *AgentRecord) GetLedgerId() string { - if x != nil { - return x.LedgerId - } - return "" -} - -func (x *AgentRecord) GetAddress() string { - if x != nil { - return x.Address - } - return "" -} - -func (x *AgentRecord) GetPublicKey() string { - if x != nil { - return x.PublicKey - } - return "" -} - -func (x *AgentRecord) GetPeerPublicKey() string { - if x != nil { - return x.PeerPublicKey - } - return "" -} - -func (x *AgentRecord) GetSignature() string { - if x != nil { - return x.Signature - } - return "" -} - -func (x *AgentRecord) GetNotBefore() string { - if x != nil { - return x.NotBefore - } - return "" -} - -func (x *AgentRecord) GetNotAfter() string { - if x != nil { - return x.NotAfter - } - return "" -} - -type Register struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Record *AgentRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"` -} - -func (x *Register) Reset() { - *x = Register{} - if protoimpl.UnsafeEnabled { - mi := &file_acn_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Register) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Register) ProtoMessage() {} - -func (x *Register) ProtoReflect() protoreflect.Message { - mi := &file_acn_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Register.ProtoReflect.Descriptor instead. -func (*Register) Descriptor() ([]byte, []int) { - return file_acn_proto_rawDescGZIP(), []int{1} -} - -func (x *Register) GetRecord() *AgentRecord { - if x != nil { - return x.Record - } - return nil -} - -type LookupRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AgentAddress string `protobuf:"bytes,1,opt,name=agent_address,json=agentAddress,proto3" json:"agent_address,omitempty"` -} - -func (x *LookupRequest) Reset() { - *x = LookupRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_acn_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LookupRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LookupRequest) ProtoMessage() {} - -func (x *LookupRequest) ProtoReflect() protoreflect.Message { - mi := &file_acn_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LookupRequest.ProtoReflect.Descriptor instead. -func (*LookupRequest) Descriptor() ([]byte, []int) { - return file_acn_proto_rawDescGZIP(), []int{2} -} - -func (x *LookupRequest) GetAgentAddress() string { - if x != nil { - return x.AgentAddress - } - return "" -} - -type LookupResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - AgentRecord *AgentRecord `protobuf:"bytes,1,opt,name=agent_record,json=agentRecord,proto3" json:"agent_record,omitempty"` -} - -func (x *LookupResponse) Reset() { - *x = LookupResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_acn_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LookupResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LookupResponse) ProtoMessage() {} - -func (x *LookupResponse) ProtoReflect() protoreflect.Message { - mi := &file_acn_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use LookupResponse.ProtoReflect.Descriptor instead. -func (*LookupResponse) Descriptor() ([]byte, []int) { - return file_acn_proto_rawDescGZIP(), []int{3} -} - -func (x *LookupResponse) GetAgentRecord() *AgentRecord { - if x != nil { - return x.AgentRecord - } - return nil -} - -type AeaEnvelope struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // TOFIX(LR) import aea.Envelop type - Envel []byte `protobuf:"bytes,1,opt,name=envel,proto3" json:"envel,omitempty"` - Record *AgentRecord `protobuf:"bytes,2,opt,name=record,proto3" json:"record,omitempty"` -} - -func (x *AeaEnvelope) Reset() { - *x = AeaEnvelope{} - if protoimpl.UnsafeEnabled { - mi := &file_acn_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AeaEnvelope) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AeaEnvelope) ProtoMessage() {} - -func (x *AeaEnvelope) ProtoReflect() protoreflect.Message { - mi := &file_acn_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AeaEnvelope.ProtoReflect.Descriptor instead. -func (*AeaEnvelope) Descriptor() ([]byte, []int) { - return file_acn_proto_rawDescGZIP(), []int{4} -} - -func (x *AeaEnvelope) GetEnvel() []byte { - if x != nil { - return x.Envel - } - return nil -} - -func (x *AeaEnvelope) GetRecord() *AgentRecord { - if x != nil { - return x.Record - } - return nil -} - -type Status struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Code Status_ErrCode `protobuf:"varint,1,opt,name=code,proto3,enum=protocols.Status_ErrCode" json:"code,omitempty"` - Msgs []string `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"` -} - -func (x *Status) Reset() { - *x = Status{} - if protoimpl.UnsafeEnabled { - mi := &file_acn_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Status) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Status) ProtoMessage() {} - -func (x *Status) ProtoReflect() protoreflect.Message { - mi := &file_acn_proto_msgTypes[5] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Status.ProtoReflect.Descriptor instead. -func (*Status) Descriptor() ([]byte, []int) { - return file_acn_proto_rawDescGZIP(), []int{5} -} - -func (x *Status) GetCode() Status_ErrCode { - if x != nil { - return x.Code - } - return Status_SUCCESS -} - -func (x *Status) GetMsgs() []string { - if x != nil { - return x.Msgs - } - return nil -} - -type AcnMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` - // Types that are assignable to Payload: - // *AcnMessage_Status - // *AcnMessage_Register - // *AcnMessage_LookupRequest - // *AcnMessage_LookupResponse - // *AcnMessage_AeaEnvelope - Payload isAcnMessage_Payload `protobuf_oneof:"payload"` -} - -func (x *AcnMessage) Reset() { - *x = AcnMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_acn_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *AcnMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*AcnMessage) ProtoMessage() {} - -func (x *AcnMessage) ProtoReflect() protoreflect.Message { - mi := &file_acn_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use AcnMessage.ProtoReflect.Descriptor instead. -func (*AcnMessage) Descriptor() ([]byte, []int) { - return file_acn_proto_rawDescGZIP(), []int{6} -} - -func (x *AcnMessage) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (m *AcnMessage) GetPayload() isAcnMessage_Payload { - if m != nil { - return m.Payload - } - return nil -} - -func (x *AcnMessage) GetStatus() *Status { - if x, ok := x.GetPayload().(*AcnMessage_Status); ok { - return x.Status - } - return nil -} - -func (x *AcnMessage) GetRegister() *Register { - if x, ok := x.GetPayload().(*AcnMessage_Register); ok { - return x.Register - } - return nil -} - -func (x *AcnMessage) GetLookupRequest() *LookupRequest { - if x, ok := x.GetPayload().(*AcnMessage_LookupRequest); ok { - return x.LookupRequest - } - return nil -} - -func (x *AcnMessage) GetLookupResponse() *LookupResponse { - if x, ok := x.GetPayload().(*AcnMessage_LookupResponse); ok { - return x.LookupResponse - } - return nil -} - -func (x *AcnMessage) GetAeaEnvelope() *AeaEnvelope { - if x, ok := x.GetPayload().(*AcnMessage_AeaEnvelope); ok { - return x.AeaEnvelope - } - return nil -} - -type isAcnMessage_Payload interface { - isAcnMessage_Payload() -} - -type AcnMessage_Status struct { - Status *Status `protobuf:"bytes,2,opt,name=status,proto3,oneof"` -} - -type AcnMessage_Register struct { - Register *Register `protobuf:"bytes,3,opt,name=register,proto3,oneof"` -} - -type AcnMessage_LookupRequest struct { - LookupRequest *LookupRequest `protobuf:"bytes,4,opt,name=lookup_request,json=lookupRequest,proto3,oneof"` -} - -type AcnMessage_LookupResponse struct { - LookupResponse *LookupResponse `protobuf:"bytes,5,opt,name=lookup_response,json=lookupResponse,proto3,oneof"` -} - -type AcnMessage_AeaEnvelope struct { - AeaEnvelope *AeaEnvelope `protobuf:"bytes,6,opt,name=aea_envelope,json=aeaEnvelope,proto3,oneof"` -} - -func (*AcnMessage_Status) isAcnMessage_Payload() {} - -func (*AcnMessage_Register) isAcnMessage_Payload() {} - -func (*AcnMessage_LookupRequest) isAcnMessage_Payload() {} - -func (*AcnMessage_LookupResponse) isAcnMessage_Payload() {} - -func (*AcnMessage_AeaEnvelope) isAcnMessage_Payload() {} - -var File_acn_proto protoreflect.FileDescriptor - -var file_acn_proto_rawDesc = []byte{ - 0x0a, 0x09, 0x61, 0x63, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x22, 0x84, 0x02, 0x0a, 0x0b, 0x41, 0x67, 0x65, 0x6e, 0x74, - 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x5f, - 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, - 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, - 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x70, - 0x65, 0x65, 0x72, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x65, 0x65, 0x72, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, - 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x6f, 0x74, 0x5f, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x6f, 0x74, 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, - 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x6f, 0x74, 0x5f, 0x61, 0x66, 0x74, 0x65, 0x72, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x74, 0x41, 0x66, 0x74, 0x65, 0x72, 0x22, 0x3a, 0x0a, - 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x2e, 0x0a, 0x06, 0x72, 0x65, 0x63, - 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, - 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0x34, 0x0a, 0x0d, 0x4c, 0x6f, 0x6f, - 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x67, - 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0c, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, - 0x4b, 0x0a, 0x0e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x39, 0x0a, 0x0c, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x72, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, - 0x6f, 0x6c, 0x73, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, - 0x0b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0x53, 0x0a, 0x0b, - 0x41, 0x65, 0x61, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, - 0x6e, 0x76, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x65, 0x6e, 0x76, 0x65, - 0x6c, 0x12, 0x2e, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x2e, 0x41, 0x67, - 0x65, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, - 0x64, 0x22, 0xfb, 0x02, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x2d, 0x0a, 0x04, - 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x45, 0x72, - 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6d, - 0x73, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x73, 0x67, 0x73, 0x22, - 0xad, 0x02, 0x0a, 0x07, 0x45, 0x72, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, - 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x19, 0x45, 0x52, 0x52, 0x4f, - 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x5f, 0x56, 0x45, - 0x52, 0x53, 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x45, 0x52, 0x52, 0x4f, 0x52, - 0x5f, 0x55, 0x4e, 0x45, 0x58, 0x50, 0x45, 0x43, 0x54, 0x45, 0x44, 0x5f, 0x50, 0x41, 0x59, 0x4c, - 0x4f, 0x41, 0x44, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x47, - 0x45, 0x4e, 0x45, 0x52, 0x49, 0x43, 0x10, 0x03, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x52, 0x52, 0x4f, - 0x52, 0x5f, 0x53, 0x45, 0x52, 0x49, 0x41, 0x4c, 0x49, 0x5a, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, - 0x04, 0x12, 0x1d, 0x0a, 0x19, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x57, 0x52, 0x4f, 0x4e, 0x47, - 0x5f, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x10, 0x0a, - 0x12, 0x1a, 0x0a, 0x16, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x57, 0x52, 0x4f, 0x4e, 0x47, 0x5f, - 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x10, 0x0b, 0x12, 0x17, 0x0a, 0x13, - 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, 0x49, 0x44, 0x5f, 0x50, 0x52, - 0x4f, 0x4f, 0x46, 0x10, 0x0c, 0x12, 0x1c, 0x0a, 0x18, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, - 0x4e, 0x53, 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x5f, 0x4c, 0x45, 0x44, 0x47, 0x45, - 0x52, 0x10, 0x0d, 0x12, 0x1f, 0x0a, 0x1b, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x4b, - 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x41, 0x44, 0x44, 0x52, 0x45, - 0x53, 0x53, 0x10, 0x14, 0x12, 0x19, 0x0a, 0x15, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x41, 0x47, - 0x45, 0x4e, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x15, 0x22, - 0xd7, 0x02, 0x0a, 0x0a, 0x41, 0x63, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2b, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x63, 0x6f, 0x6c, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x48, 0x00, 0x52, 0x06, 0x73, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x31, 0x0a, 0x08, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, - 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, - 0x6f, 0x6c, 0x73, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x48, 0x00, 0x52, 0x08, - 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x41, 0x0a, 0x0e, 0x6c, 0x6f, 0x6f, 0x6b, - 0x75, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, 0x2e, 0x4c, 0x6f, 0x6f, - 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x48, 0x00, 0x52, 0x0d, 0x6c, 0x6f, - 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x44, 0x0a, 0x0f, 0x6c, - 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x5f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x73, - 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x48, - 0x00, 0x52, 0x0e, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x3b, 0x0a, 0x0c, 0x61, 0x65, 0x61, 0x5f, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, - 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, - 0x6f, 0x6c, 0x73, 0x2e, 0x41, 0x65, 0x61, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x48, - 0x00, 0x52, 0x0b, 0x61, 0x65, 0x61, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x42, 0x09, - 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_acn_proto_rawDescOnce sync.Once - file_acn_proto_rawDescData = file_acn_proto_rawDesc -) - -func file_acn_proto_rawDescGZIP() []byte { - file_acn_proto_rawDescOnce.Do(func() { - file_acn_proto_rawDescData = protoimpl.X.CompressGZIP(file_acn_proto_rawDescData) - }) - return file_acn_proto_rawDescData -} - -var file_acn_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_acn_proto_msgTypes = make([]protoimpl.MessageInfo, 7) -var file_acn_proto_goTypes = []interface{}{ - (Status_ErrCode)(0), // 0: protocols.Status.ErrCode - (*AgentRecord)(nil), // 1: protocols.AgentRecord - (*Register)(nil), // 2: protocols.Register - (*LookupRequest)(nil), // 3: protocols.LookupRequest - (*LookupResponse)(nil), // 4: protocols.LookupResponse - (*AeaEnvelope)(nil), // 5: protocols.AeaEnvelope - (*Status)(nil), // 6: protocols.Status - (*AcnMessage)(nil), // 7: protocols.AcnMessage -} -var file_acn_proto_depIdxs = []int32{ - 1, // 0: protocols.Register.record:type_name -> protocols.AgentRecord - 1, // 1: protocols.LookupResponse.agent_record:type_name -> protocols.AgentRecord - 1, // 2: protocols.AeaEnvelope.record:type_name -> protocols.AgentRecord - 0, // 3: protocols.Status.code:type_name -> protocols.Status.ErrCode - 6, // 4: protocols.AcnMessage.status:type_name -> protocols.Status - 2, // 5: protocols.AcnMessage.register:type_name -> protocols.Register - 3, // 6: protocols.AcnMessage.lookup_request:type_name -> protocols.LookupRequest - 4, // 7: protocols.AcnMessage.lookup_response:type_name -> protocols.LookupResponse - 5, // 8: protocols.AcnMessage.aea_envelope:type_name -> protocols.AeaEnvelope - 9, // [9:9] is the sub-list for method output_type - 9, // [9:9] is the sub-list for method input_type - 9, // [9:9] is the sub-list for extension type_name - 9, // [9:9] is the sub-list for extension extendee - 0, // [0:9] is the sub-list for field type_name -} - -func init() { file_acn_proto_init() } -func file_acn_proto_init() { - if File_acn_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_acn_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AgentRecord); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_acn_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Register); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_acn_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LookupRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_acn_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LookupResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_acn_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AeaEnvelope); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_acn_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Status); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_acn_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*AcnMessage); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_acn_proto_msgTypes[6].OneofWrappers = []interface{}{ - (*AcnMessage_Status)(nil), - (*AcnMessage_Register)(nil), - (*AcnMessage_LookupRequest)(nil), - (*AcnMessage_LookupResponse)(nil), - (*AcnMessage_AeaEnvelope)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_acn_proto_rawDesc, - NumEnums: 1, - NumMessages: 7, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_acn_proto_goTypes, - DependencyIndexes: file_acn_proto_depIdxs, - EnumInfos: file_acn_proto_enumTypes, - MessageInfos: file_acn_proto_msgTypes, - }.Build() - File_acn_proto = out.File - file_acn_proto_rawDesc = nil - file_acn_proto_goTypes = nil - file_acn_proto_depIdxs = nil -} diff --git a/libs/go/aealite/protocols/acn.proto b/libs/go/aealite/protocols/acn.proto deleted file mode 100644 index ccbd2e36cb..0000000000 --- a/libs/go/aealite/protocols/acn.proto +++ /dev/null @@ -1,67 +0,0 @@ -syntax = "proto3"; - -package aea.acn.v0_1_0; - -option go_package = "aealite/protocols"; - -message AgentRecord { - string service_id = 1; - string ledger_id = 2; - string address = 3; - string public_key = 4; - string peer_public_key = 5; - string signature = 6; - string not_before = 7; - string not_after = 8; -} - -message Register { - AgentRecord record = 1; -} - -message LookupRequest { - string agent_address = 1; -} - -message LookupResponse { - AgentRecord agent_record = 1; -} - -message AeaEnvelope { - // TOFIX(LR) import aea.Envelop type - bytes envel = 1; - AgentRecord record = 2; -} - -message Status { - enum ErrCode { - // common (0x) - SUCCESS = 0; - ERROR_UNSUPPORTED_VERSION = 1; - ERROR_UNEXPECTED_PAYLOAD = 2; - ERROR_GENERIC = 3; - ERROR_SERIALIZATION = 4; - // register (1x) - ERROR_WRONG_AGENT_ADDRESS = 10; - ERROR_WRONG_PUBLIC_KEY = 11; - ERROR_INVALID_PROOF = 12; - ERROR_UNSUPPORTED_LEDGER = 13; - // lookup & delivery (2x) - ERROR_UNKNOWN_AGENT_ADDRESS = 20; - ERROR_AGENT_NOT_READY = 21; - } - - ErrCode code = 1; - repeated string msgs = 2; -} - -message AcnMessage { - string version = 1; - oneof payload { - Status status = 2; - Register register = 3; - LookupRequest lookup_request = 4; - LookupResponse lookup_response = 5; - AeaEnvelope aea_envelope = 6; - } -} \ No newline at end of file diff --git a/libs/go/aealite/protocols/acn/v1_0_0/acn.pb.go b/libs/go/aealite/protocols/acn/v1_0_0/acn.pb.go new file mode 100644 index 0000000000..fe9a18a6e8 --- /dev/null +++ b/libs/go/aealite/protocols/acn/v1_0_0/acn.pb.go @@ -0,0 +1,912 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.11.4 +// source: acn.proto + +package aea_aea_acn_v1_0_0 + +import ( + proto "github.com/golang/protobuf/proto" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type AcnMessage_StatusBody_StatusCodeEnum int32 + +const ( + // common (0x) + AcnMessage_StatusBody_SUCCESS AcnMessage_StatusBody_StatusCodeEnum = 0 + AcnMessage_StatusBody_ERROR_UNSUPPORTED_VERSION AcnMessage_StatusBody_StatusCodeEnum = 1 + AcnMessage_StatusBody_ERROR_UNEXPECTED_PAYLOAD AcnMessage_StatusBody_StatusCodeEnum = 2 + AcnMessage_StatusBody_ERROR_GENERIC AcnMessage_StatusBody_StatusCodeEnum = 3 + AcnMessage_StatusBody_ERROR_DECODE AcnMessage_StatusBody_StatusCodeEnum = 4 + // register (1x) + AcnMessage_StatusBody_ERROR_WRONG_AGENT_ADDRESS AcnMessage_StatusBody_StatusCodeEnum = 10 + AcnMessage_StatusBody_ERROR_WRONG_PUBLIC_KEY AcnMessage_StatusBody_StatusCodeEnum = 11 + AcnMessage_StatusBody_ERROR_INVALID_PROOF AcnMessage_StatusBody_StatusCodeEnum = 12 + AcnMessage_StatusBody_ERROR_UNSUPPORTED_LEDGER AcnMessage_StatusBody_StatusCodeEnum = 13 + // lookup & delivery (2x) + AcnMessage_StatusBody_ERROR_UNKNOWN_AGENT_ADDRESS AcnMessage_StatusBody_StatusCodeEnum = 20 + AcnMessage_StatusBody_ERROR_AGENT_NOT_READY AcnMessage_StatusBody_StatusCodeEnum = 21 +) + +// Enum value maps for AcnMessage_StatusBody_StatusCodeEnum. +var ( + AcnMessage_StatusBody_StatusCodeEnum_name = map[int32]string{ + 0: "SUCCESS", + 1: "ERROR_UNSUPPORTED_VERSION", + 2: "ERROR_UNEXPECTED_PAYLOAD", + 3: "ERROR_GENERIC", + 4: "ERROR_DECODE", + 10: "ERROR_WRONG_AGENT_ADDRESS", + 11: "ERROR_WRONG_PUBLIC_KEY", + 12: "ERROR_INVALID_PROOF", + 13: "ERROR_UNSUPPORTED_LEDGER", + 20: "ERROR_UNKNOWN_AGENT_ADDRESS", + 21: "ERROR_AGENT_NOT_READY", + } + AcnMessage_StatusBody_StatusCodeEnum_value = map[string]int32{ + "SUCCESS": 0, + "ERROR_UNSUPPORTED_VERSION": 1, + "ERROR_UNEXPECTED_PAYLOAD": 2, + "ERROR_GENERIC": 3, + "ERROR_DECODE": 4, + "ERROR_WRONG_AGENT_ADDRESS": 10, + "ERROR_WRONG_PUBLIC_KEY": 11, + "ERROR_INVALID_PROOF": 12, + "ERROR_UNSUPPORTED_LEDGER": 13, + "ERROR_UNKNOWN_AGENT_ADDRESS": 20, + "ERROR_AGENT_NOT_READY": 21, + } +) + +func (x AcnMessage_StatusBody_StatusCodeEnum) Enum() *AcnMessage_StatusBody_StatusCodeEnum { + p := new(AcnMessage_StatusBody_StatusCodeEnum) + *p = x + return p +} + +func (x AcnMessage_StatusBody_StatusCodeEnum) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (AcnMessage_StatusBody_StatusCodeEnum) Descriptor() protoreflect.EnumDescriptor { + return file_acn_proto_enumTypes[0].Descriptor() +} + +func (AcnMessage_StatusBody_StatusCodeEnum) Type() protoreflect.EnumType { + return &file_acn_proto_enumTypes[0] +} + +func (x AcnMessage_StatusBody_StatusCodeEnum) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use AcnMessage_StatusBody_StatusCodeEnum.Descriptor instead. +func (AcnMessage_StatusBody_StatusCodeEnum) EnumDescriptor() ([]byte, []int) { + return file_acn_proto_rawDescGZIP(), []int{0, 1, 0} +} + +type AcnMessage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Types that are assignable to Performative: + // *AcnMessage_AeaEnvelope + // *AcnMessage_LookupRequest + // *AcnMessage_LookupResponse + // *AcnMessage_Register + // *AcnMessage_Status + Performative isAcnMessage_Performative `protobuf_oneof:"performative"` +} + +func (x *AcnMessage) Reset() { + *x = AcnMessage{} + if protoimpl.UnsafeEnabled { + mi := &file_acn_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AcnMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AcnMessage) ProtoMessage() {} + +func (x *AcnMessage) ProtoReflect() protoreflect.Message { + mi := &file_acn_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AcnMessage.ProtoReflect.Descriptor instead. +func (*AcnMessage) Descriptor() ([]byte, []int) { + return file_acn_proto_rawDescGZIP(), []int{0} +} + +func (m *AcnMessage) GetPerformative() isAcnMessage_Performative { + if m != nil { + return m.Performative + } + return nil +} + +func (x *AcnMessage) GetAeaEnvelope() *AcnMessage_Aea_Envelope_Performative { + if x, ok := x.GetPerformative().(*AcnMessage_AeaEnvelope); ok { + return x.AeaEnvelope + } + return nil +} + +func (x *AcnMessage) GetLookupRequest() *AcnMessage_Lookup_Request_Performative { + if x, ok := x.GetPerformative().(*AcnMessage_LookupRequest); ok { + return x.LookupRequest + } + return nil +} + +func (x *AcnMessage) GetLookupResponse() *AcnMessage_Lookup_Response_Performative { + if x, ok := x.GetPerformative().(*AcnMessage_LookupResponse); ok { + return x.LookupResponse + } + return nil +} + +func (x *AcnMessage) GetRegister() *AcnMessage_Register_Performative { + if x, ok := x.GetPerformative().(*AcnMessage_Register); ok { + return x.Register + } + return nil +} + +func (x *AcnMessage) GetStatus() *AcnMessage_Status_Performative { + if x, ok := x.GetPerformative().(*AcnMessage_Status); ok { + return x.Status + } + return nil +} + +type isAcnMessage_Performative interface { + isAcnMessage_Performative() +} + +type AcnMessage_AeaEnvelope struct { + AeaEnvelope *AcnMessage_Aea_Envelope_Performative `protobuf:"bytes,5,opt,name=aea_envelope,json=aeaEnvelope,proto3,oneof"` +} + +type AcnMessage_LookupRequest struct { + LookupRequest *AcnMessage_Lookup_Request_Performative `protobuf:"bytes,6,opt,name=lookup_request,json=lookupRequest,proto3,oneof"` +} + +type AcnMessage_LookupResponse struct { + LookupResponse *AcnMessage_Lookup_Response_Performative `protobuf:"bytes,7,opt,name=lookup_response,json=lookupResponse,proto3,oneof"` +} + +type AcnMessage_Register struct { + Register *AcnMessage_Register_Performative `protobuf:"bytes,8,opt,name=register,proto3,oneof"` +} + +type AcnMessage_Status struct { + Status *AcnMessage_Status_Performative `protobuf:"bytes,9,opt,name=status,proto3,oneof"` +} + +func (*AcnMessage_AeaEnvelope) isAcnMessage_Performative() {} + +func (*AcnMessage_LookupRequest) isAcnMessage_Performative() {} + +func (*AcnMessage_LookupResponse) isAcnMessage_Performative() {} + +func (*AcnMessage_Register) isAcnMessage_Performative() {} + +func (*AcnMessage_Status) isAcnMessage_Performative() {} + +// Custom Types +type AcnMessage_AgentRecord struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"` + LedgerId string `protobuf:"bytes,2,opt,name=ledger_id,json=ledgerId,proto3" json:"ledger_id,omitempty"` + Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"` + PublicKey string `protobuf:"bytes,4,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + PeerPublicKey string `protobuf:"bytes,5,opt,name=peer_public_key,json=peerPublicKey,proto3" json:"peer_public_key,omitempty"` + Signature string `protobuf:"bytes,6,opt,name=signature,proto3" json:"signature,omitempty"` + NotBefore string `protobuf:"bytes,7,opt,name=not_before,json=notBefore,proto3" json:"not_before,omitempty"` + NotAfter string `protobuf:"bytes,8,opt,name=not_after,json=notAfter,proto3" json:"not_after,omitempty"` +} + +func (x *AcnMessage_AgentRecord) Reset() { + *x = AcnMessage_AgentRecord{} + if protoimpl.UnsafeEnabled { + mi := &file_acn_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AcnMessage_AgentRecord) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AcnMessage_AgentRecord) ProtoMessage() {} + +func (x *AcnMessage_AgentRecord) ProtoReflect() protoreflect.Message { + mi := &file_acn_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AcnMessage_AgentRecord.ProtoReflect.Descriptor instead. +func (*AcnMessage_AgentRecord) Descriptor() ([]byte, []int) { + return file_acn_proto_rawDescGZIP(), []int{0, 0} +} + +func (x *AcnMessage_AgentRecord) GetServiceId() string { + if x != nil { + return x.ServiceId + } + return "" +} + +func (x *AcnMessage_AgentRecord) GetLedgerId() string { + if x != nil { + return x.LedgerId + } + return "" +} + +func (x *AcnMessage_AgentRecord) GetAddress() string { + if x != nil { + return x.Address + } + return "" +} + +func (x *AcnMessage_AgentRecord) GetPublicKey() string { + if x != nil { + return x.PublicKey + } + return "" +} + +func (x *AcnMessage_AgentRecord) GetPeerPublicKey() string { + if x != nil { + return x.PeerPublicKey + } + return "" +} + +func (x *AcnMessage_AgentRecord) GetSignature() string { + if x != nil { + return x.Signature + } + return "" +} + +func (x *AcnMessage_AgentRecord) GetNotBefore() string { + if x != nil { + return x.NotBefore + } + return "" +} + +func (x *AcnMessage_AgentRecord) GetNotAfter() string { + if x != nil { + return x.NotAfter + } + return "" +} + +type AcnMessage_StatusBody struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code AcnMessage_StatusBody_StatusCodeEnum `protobuf:"varint,1,opt,name=code,proto3,enum=aea.aea.acn.v1_0_0.AcnMessage_StatusBody_StatusCodeEnum" json:"code,omitempty"` + Msgs []string `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"` +} + +func (x *AcnMessage_StatusBody) Reset() { + *x = AcnMessage_StatusBody{} + if protoimpl.UnsafeEnabled { + mi := &file_acn_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AcnMessage_StatusBody) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AcnMessage_StatusBody) ProtoMessage() {} + +func (x *AcnMessage_StatusBody) ProtoReflect() protoreflect.Message { + mi := &file_acn_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AcnMessage_StatusBody.ProtoReflect.Descriptor instead. +func (*AcnMessage_StatusBody) Descriptor() ([]byte, []int) { + return file_acn_proto_rawDescGZIP(), []int{0, 1} +} + +func (x *AcnMessage_StatusBody) GetCode() AcnMessage_StatusBody_StatusCodeEnum { + if x != nil { + return x.Code + } + return AcnMessage_StatusBody_SUCCESS +} + +func (x *AcnMessage_StatusBody) GetMsgs() []string { + if x != nil { + return x.Msgs + } + return nil +} + +// Performatives and contents +type AcnMessage_Register_Performative struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Record *AcnMessage_AgentRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"` +} + +func (x *AcnMessage_Register_Performative) Reset() { + *x = AcnMessage_Register_Performative{} + if protoimpl.UnsafeEnabled { + mi := &file_acn_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AcnMessage_Register_Performative) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AcnMessage_Register_Performative) ProtoMessage() {} + +func (x *AcnMessage_Register_Performative) ProtoReflect() protoreflect.Message { + mi := &file_acn_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AcnMessage_Register_Performative.ProtoReflect.Descriptor instead. +func (*AcnMessage_Register_Performative) Descriptor() ([]byte, []int) { + return file_acn_proto_rawDescGZIP(), []int{0, 2} +} + +func (x *AcnMessage_Register_Performative) GetRecord() *AcnMessage_AgentRecord { + if x != nil { + return x.Record + } + return nil +} + +type AcnMessage_Lookup_Request_Performative struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + AgentAddress string `protobuf:"bytes,1,opt,name=agent_address,json=agentAddress,proto3" json:"agent_address,omitempty"` +} + +func (x *AcnMessage_Lookup_Request_Performative) Reset() { + *x = AcnMessage_Lookup_Request_Performative{} + if protoimpl.UnsafeEnabled { + mi := &file_acn_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AcnMessage_Lookup_Request_Performative) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AcnMessage_Lookup_Request_Performative) ProtoMessage() {} + +func (x *AcnMessage_Lookup_Request_Performative) ProtoReflect() protoreflect.Message { + mi := &file_acn_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AcnMessage_Lookup_Request_Performative.ProtoReflect.Descriptor instead. +func (*AcnMessage_Lookup_Request_Performative) Descriptor() ([]byte, []int) { + return file_acn_proto_rawDescGZIP(), []int{0, 3} +} + +func (x *AcnMessage_Lookup_Request_Performative) GetAgentAddress() string { + if x != nil { + return x.AgentAddress + } + return "" +} + +type AcnMessage_Lookup_Response_Performative struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Record *AcnMessage_AgentRecord `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"` +} + +func (x *AcnMessage_Lookup_Response_Performative) Reset() { + *x = AcnMessage_Lookup_Response_Performative{} + if protoimpl.UnsafeEnabled { + mi := &file_acn_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AcnMessage_Lookup_Response_Performative) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AcnMessage_Lookup_Response_Performative) ProtoMessage() {} + +func (x *AcnMessage_Lookup_Response_Performative) ProtoReflect() protoreflect.Message { + mi := &file_acn_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AcnMessage_Lookup_Response_Performative.ProtoReflect.Descriptor instead. +func (*AcnMessage_Lookup_Response_Performative) Descriptor() ([]byte, []int) { + return file_acn_proto_rawDescGZIP(), []int{0, 4} +} + +func (x *AcnMessage_Lookup_Response_Performative) GetRecord() *AcnMessage_AgentRecord { + if x != nil { + return x.Record + } + return nil +} + +type AcnMessage_Aea_Envelope_Performative struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Envelope []byte `protobuf:"bytes,1,opt,name=envelope,proto3" json:"envelope,omitempty"` + Record *AcnMessage_AgentRecord `protobuf:"bytes,2,opt,name=record,proto3" json:"record,omitempty"` +} + +func (x *AcnMessage_Aea_Envelope_Performative) Reset() { + *x = AcnMessage_Aea_Envelope_Performative{} + if protoimpl.UnsafeEnabled { + mi := &file_acn_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AcnMessage_Aea_Envelope_Performative) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AcnMessage_Aea_Envelope_Performative) ProtoMessage() {} + +func (x *AcnMessage_Aea_Envelope_Performative) ProtoReflect() protoreflect.Message { + mi := &file_acn_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AcnMessage_Aea_Envelope_Performative.ProtoReflect.Descriptor instead. +func (*AcnMessage_Aea_Envelope_Performative) Descriptor() ([]byte, []int) { + return file_acn_proto_rawDescGZIP(), []int{0, 5} +} + +func (x *AcnMessage_Aea_Envelope_Performative) GetEnvelope() []byte { + if x != nil { + return x.Envelope + } + return nil +} + +func (x *AcnMessage_Aea_Envelope_Performative) GetRecord() *AcnMessage_AgentRecord { + if x != nil { + return x.Record + } + return nil +} + +type AcnMessage_Status_Performative struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Body *AcnMessage_StatusBody `protobuf:"bytes,1,opt,name=body,proto3" json:"body,omitempty"` +} + +func (x *AcnMessage_Status_Performative) Reset() { + *x = AcnMessage_Status_Performative{} + if protoimpl.UnsafeEnabled { + mi := &file_acn_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AcnMessage_Status_Performative) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AcnMessage_Status_Performative) ProtoMessage() {} + +func (x *AcnMessage_Status_Performative) ProtoReflect() protoreflect.Message { + mi := &file_acn_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AcnMessage_Status_Performative.ProtoReflect.Descriptor instead. +func (*AcnMessage_Status_Performative) Descriptor() ([]byte, []int) { + return file_acn_proto_rawDescGZIP(), []int{0, 6} +} + +func (x *AcnMessage_Status_Performative) GetBody() *AcnMessage_StatusBody { + if x != nil { + return x.Body + } + return nil +} + +var File_acn_proto protoreflect.FileDescriptor + +var file_acn_proto_rawDesc = []byte{ + 0x0a, 0x09, 0x61, 0x63, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x12, 0x61, 0x65, 0x61, + 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x63, 0x6e, 0x2e, 0x76, 0x31, 0x5f, 0x30, 0x5f, 0x30, 0x22, + 0xea, 0x0c, 0x0a, 0x0a, 0x41, 0x63, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x5d, + 0x0a, 0x0c, 0x61, 0x65, 0x61, 0x5f, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x38, 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, + 0x63, 0x6e, 0x2e, 0x76, 0x31, 0x5f, 0x30, 0x5f, 0x30, 0x2e, 0x41, 0x63, 0x6e, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x65, 0x61, 0x5f, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, + 0x65, 0x5f, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x76, 0x65, 0x48, 0x00, + 0x52, 0x0b, 0x61, 0x65, 0x61, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x12, 0x63, 0x0a, + 0x0e, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3a, 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x65, 0x61, 0x2e, + 0x61, 0x63, 0x6e, 0x2e, 0x76, 0x31, 0x5f, 0x30, 0x5f, 0x30, 0x2e, 0x41, 0x63, 0x6e, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x5f, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x5f, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x76, + 0x65, 0x48, 0x00, 0x52, 0x0d, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x66, 0x0a, 0x0f, 0x6c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x5f, 0x72, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x3b, 0x2e, 0x61, 0x65, + 0x61, 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x63, 0x6e, 0x2e, 0x76, 0x31, 0x5f, 0x30, 0x5f, 0x30, + 0x2e, 0x41, 0x63, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x4c, 0x6f, 0x6f, 0x6b, + 0x75, 0x70, 0x5f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x50, 0x65, 0x72, 0x66, + 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x76, 0x65, 0x48, 0x00, 0x52, 0x0e, 0x6c, 0x6f, 0x6f, 0x6b, + 0x75, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x52, 0x0a, 0x08, 0x72, 0x65, + 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x34, 0x2e, 0x61, + 0x65, 0x61, 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x63, 0x6e, 0x2e, 0x76, 0x31, 0x5f, 0x30, 0x5f, + 0x30, 0x2e, 0x41, 0x63, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x52, 0x65, 0x67, + 0x69, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, + 0x76, 0x65, 0x48, 0x00, 0x52, 0x08, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x4c, + 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x32, + 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x63, 0x6e, 0x2e, 0x76, 0x31, 0x5f, + 0x30, 0x5f, 0x30, 0x2e, 0x41, 0x63, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x5f, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, + 0x76, 0x65, 0x48, 0x00, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x1a, 0x84, 0x02, 0x0a, + 0x0b, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x1d, 0x0a, 0x0a, + 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x09, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6c, + 0x65, 0x64, 0x67, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x5f, 0x6b, 0x65, 0x79, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, + 0x79, 0x12, 0x26, 0x0a, 0x0f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x70, 0x75, 0x62, 0x6c, 0x69, 0x63, + 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x70, 0x65, 0x65, 0x72, + 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, + 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, + 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6e, 0x6f, 0x74, 0x5f, 0x62, + 0x65, 0x66, 0x6f, 0x72, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x6f, 0x74, + 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6e, 0x6f, 0x74, 0x5f, 0x61, 0x66, + 0x74, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x74, 0x41, 0x66, + 0x74, 0x65, 0x72, 0x1a, 0x9e, 0x03, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x6f, + 0x64, 0x79, 0x12, 0x4c, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, + 0x32, 0x38, 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x63, 0x6e, 0x2e, 0x76, + 0x31, 0x5f, 0x30, 0x5f, 0x30, 0x2e, 0x41, 0x63, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x6f, 0x64, 0x79, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x73, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, + 0x6d, 0x73, 0x67, 0x73, 0x22, 0xad, 0x02, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x43, + 0x6f, 0x64, 0x65, 0x45, 0x6e, 0x75, 0x6d, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, + 0x53, 0x53, 0x10, 0x00, 0x12, 0x1d, 0x0a, 0x19, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, 0x4e, + 0x53, 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x5f, 0x56, 0x45, 0x52, 0x53, 0x49, 0x4f, + 0x4e, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x45, + 0x58, 0x50, 0x45, 0x43, 0x54, 0x45, 0x44, 0x5f, 0x50, 0x41, 0x59, 0x4c, 0x4f, 0x41, 0x44, 0x10, + 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x52, + 0x49, 0x43, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x44, 0x45, + 0x43, 0x4f, 0x44, 0x45, 0x10, 0x04, 0x12, 0x1d, 0x0a, 0x19, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, + 0x57, 0x52, 0x4f, 0x4e, 0x47, 0x5f, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x41, 0x44, 0x44, 0x52, + 0x45, 0x53, 0x53, 0x10, 0x0a, 0x12, 0x1a, 0x0a, 0x16, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x57, + 0x52, 0x4f, 0x4e, 0x47, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x5f, 0x4b, 0x45, 0x59, 0x10, + 0x0b, 0x12, 0x17, 0x0a, 0x13, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x5f, 0x49, 0x4e, 0x56, 0x41, 0x4c, + 0x49, 0x44, 0x5f, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x10, 0x0c, 0x12, 0x1c, 0x0a, 0x18, 0x45, 0x52, + 0x52, 0x4f, 0x52, 0x5f, 0x55, 0x4e, 0x53, 0x55, 0x50, 0x50, 0x4f, 0x52, 0x54, 0x45, 0x44, 0x5f, + 0x4c, 0x45, 0x44, 0x47, 0x45, 0x52, 0x10, 0x0d, 0x12, 0x1f, 0x0a, 0x1b, 0x45, 0x52, 0x52, 0x4f, + 0x52, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x5f, + 0x41, 0x44, 0x44, 0x52, 0x45, 0x53, 0x53, 0x10, 0x14, 0x12, 0x19, 0x0a, 0x15, 0x45, 0x52, 0x52, + 0x4f, 0x52, 0x5f, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x52, 0x45, 0x41, + 0x44, 0x59, 0x10, 0x15, 0x1a, 0x5b, 0x0a, 0x15, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, + 0x5f, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x76, 0x65, 0x12, 0x42, 0x0a, + 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, + 0x61, 0x65, 0x61, 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x63, 0x6e, 0x2e, 0x76, 0x31, 0x5f, 0x30, + 0x5f, 0x30, 0x2e, 0x41, 0x63, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x67, + 0x65, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x1a, 0x42, 0x0a, 0x1b, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x5f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x5f, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x76, 0x65, + 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x1a, 0x62, 0x0a, 0x1c, 0x4c, 0x6f, 0x6f, 0x6b, 0x75, 0x70, 0x5f, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, + 0x61, 0x74, 0x69, 0x76, 0x65, 0x12, 0x42, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x65, 0x61, 0x2e, + 0x61, 0x63, 0x6e, 0x2e, 0x76, 0x31, 0x5f, 0x30, 0x5f, 0x30, 0x2e, 0x41, 0x63, 0x6e, 0x4d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, + 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x1a, 0x7b, 0x0a, 0x19, 0x41, 0x65, 0x61, + 0x5f, 0x45, 0x6e, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x65, 0x5f, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, + 0x6d, 0x61, 0x74, 0x69, 0x76, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, + 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x65, 0x6e, 0x76, 0x65, 0x6c, 0x6f, + 0x70, 0x65, 0x12, 0x42, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x63, 0x6e, + 0x2e, 0x76, 0x31, 0x5f, 0x30, 0x5f, 0x30, 0x2e, 0x41, 0x63, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, + 0x67, 0x65, 0x2e, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, + 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x1a, 0x54, 0x0a, 0x13, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x5f, 0x50, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x76, 0x65, 0x12, 0x3d, 0x0a, + 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x61, 0x65, + 0x61, 0x2e, 0x61, 0x65, 0x61, 0x2e, 0x61, 0x63, 0x6e, 0x2e, 0x76, 0x31, 0x5f, 0x30, 0x5f, 0x30, + 0x2e, 0x41, 0x63, 0x6e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x53, 0x74, 0x61, 0x74, + 0x75, 0x73, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x42, 0x0e, 0x0a, 0x0c, + 0x70, 0x65, 0x72, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x76, 0x65, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_acn_proto_rawDescOnce sync.Once + file_acn_proto_rawDescData = file_acn_proto_rawDesc +) + +func file_acn_proto_rawDescGZIP() []byte { + file_acn_proto_rawDescOnce.Do(func() { + file_acn_proto_rawDescData = protoimpl.X.CompressGZIP(file_acn_proto_rawDescData) + }) + return file_acn_proto_rawDescData +} + +var file_acn_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_acn_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_acn_proto_goTypes = []interface{}{ + (AcnMessage_StatusBody_StatusCodeEnum)(0), // 0: aea.aea.acn.v1_0_0.AcnMessage.StatusBody.StatusCodeEnum + (*AcnMessage)(nil), // 1: aea.aea.acn.v1_0_0.AcnMessage + (*AcnMessage_AgentRecord)(nil), // 2: aea.aea.acn.v1_0_0.AcnMessage.AgentRecord + (*AcnMessage_StatusBody)(nil), // 3: aea.aea.acn.v1_0_0.AcnMessage.StatusBody + (*AcnMessage_Register_Performative)(nil), // 4: aea.aea.acn.v1_0_0.AcnMessage.Register_Performative + (*AcnMessage_Lookup_Request_Performative)(nil), // 5: aea.aea.acn.v1_0_0.AcnMessage.Lookup_Request_Performative + (*AcnMessage_Lookup_Response_Performative)(nil), // 6: aea.aea.acn.v1_0_0.AcnMessage.Lookup_Response_Performative + (*AcnMessage_Aea_Envelope_Performative)(nil), // 7: aea.aea.acn.v1_0_0.AcnMessage.Aea_Envelope_Performative + (*AcnMessage_Status_Performative)(nil), // 8: aea.aea.acn.v1_0_0.AcnMessage.Status_Performative +} +var file_acn_proto_depIdxs = []int32{ + 7, // 0: aea.aea.acn.v1_0_0.AcnMessage.aea_envelope:type_name -> aea.aea.acn.v1_0_0.AcnMessage.Aea_Envelope_Performative + 5, // 1: aea.aea.acn.v1_0_0.AcnMessage.lookup_request:type_name -> aea.aea.acn.v1_0_0.AcnMessage.Lookup_Request_Performative + 6, // 2: aea.aea.acn.v1_0_0.AcnMessage.lookup_response:type_name -> aea.aea.acn.v1_0_0.AcnMessage.Lookup_Response_Performative + 4, // 3: aea.aea.acn.v1_0_0.AcnMessage.register:type_name -> aea.aea.acn.v1_0_0.AcnMessage.Register_Performative + 8, // 4: aea.aea.acn.v1_0_0.AcnMessage.status:type_name -> aea.aea.acn.v1_0_0.AcnMessage.Status_Performative + 0, // 5: aea.aea.acn.v1_0_0.AcnMessage.StatusBody.code:type_name -> aea.aea.acn.v1_0_0.AcnMessage.StatusBody.StatusCodeEnum + 2, // 6: aea.aea.acn.v1_0_0.AcnMessage.Register_Performative.record:type_name -> aea.aea.acn.v1_0_0.AcnMessage.AgentRecord + 2, // 7: aea.aea.acn.v1_0_0.AcnMessage.Lookup_Response_Performative.record:type_name -> aea.aea.acn.v1_0_0.AcnMessage.AgentRecord + 2, // 8: aea.aea.acn.v1_0_0.AcnMessage.Aea_Envelope_Performative.record:type_name -> aea.aea.acn.v1_0_0.AcnMessage.AgentRecord + 3, // 9: aea.aea.acn.v1_0_0.AcnMessage.Status_Performative.body:type_name -> aea.aea.acn.v1_0_0.AcnMessage.StatusBody + 10, // [10:10] is the sub-list for method output_type + 10, // [10:10] is the sub-list for method input_type + 10, // [10:10] is the sub-list for extension type_name + 10, // [10:10] is the sub-list for extension extendee + 0, // [0:10] is the sub-list for field type_name +} + +func init() { file_acn_proto_init() } +func file_acn_proto_init() { + if File_acn_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_acn_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AcnMessage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_acn_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AcnMessage_AgentRecord); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_acn_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AcnMessage_StatusBody); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_acn_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AcnMessage_Register_Performative); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_acn_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AcnMessage_Lookup_Request_Performative); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_acn_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AcnMessage_Lookup_Response_Performative); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_acn_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AcnMessage_Aea_Envelope_Performative); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_acn_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AcnMessage_Status_Performative); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_acn_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*AcnMessage_AeaEnvelope)(nil), + (*AcnMessage_LookupRequest)(nil), + (*AcnMessage_LookupResponse)(nil), + (*AcnMessage_Register)(nil), + (*AcnMessage_Status)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_acn_proto_rawDesc, + NumEnums: 1, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_acn_proto_goTypes, + DependencyIndexes: file_acn_proto_depIdxs, + EnumInfos: file_acn_proto_enumTypes, + MessageInfos: file_acn_proto_msgTypes, + }.Build() + File_acn_proto = out.File + file_acn_proto_rawDesc = nil + file_acn_proto_goTypes = nil + file_acn_proto_depIdxs = nil +} diff --git a/libs/go/aealite/protocols/acn/v1_0_0/acn.proto b/libs/go/aealite/protocols/acn/v1_0_0/acn.proto new file mode 100644 index 0000000000..79a6f699f2 --- /dev/null +++ b/libs/go/aealite/protocols/acn/v1_0_0/acn.proto @@ -0,0 +1,73 @@ +syntax = "proto3"; + +package aea.aea.acn.v1_0_0; + +option go_package = "libp2p_node/protocols/acn/v1_0_0"; + +message AcnMessage{ + + // Custom Types + message AgentRecord{ + string service_id = 1; + string ledger_id = 2; + string address = 3; + string public_key = 4; + string peer_public_key = 5; + string signature = 6; + string not_before = 7; + string not_after = 8; + } + + message StatusBody{ + enum StatusCodeEnum { + // common (0x) + SUCCESS = 0; + ERROR_UNSUPPORTED_VERSION = 1; + ERROR_UNEXPECTED_PAYLOAD = 2; + ERROR_GENERIC = 3; + ERROR_DECODE = 4; + // register (1x) + ERROR_WRONG_AGENT_ADDRESS = 10; + ERROR_WRONG_PUBLIC_KEY = 11; + ERROR_INVALID_PROOF = 12; + ERROR_UNSUPPORTED_LEDGER = 13; + // lookup & delivery (2x) + ERROR_UNKNOWN_AGENT_ADDRESS = 20; + ERROR_AGENT_NOT_READY = 21; + } + StatusCodeEnum code = 1; + repeated string msgs = 2; + } + + + // Performatives and contents + message Register_Performative{ + AgentRecord record = 1; + } + + message Lookup_Request_Performative{ + string agent_address = 1; + } + + message Lookup_Response_Performative{ + AgentRecord record = 1; + } + + message Aea_Envelope_Performative{ + bytes envelope = 1; + AgentRecord record = 2; + } + + message Status_Performative{ + StatusBody body = 1; + } + + + oneof performative{ + Aea_Envelope_Performative aea_envelope = 5; + Lookup_Request_Performative lookup_request = 6; + Lookup_Response_Performative lookup_response = 7; + Register_Performative register = 8; + Status_Performative status = 9; + } +} diff --git a/libs/go/aealite/protocols/acn/v1_0_0/acn.yaml b/libs/go/aealite/protocols/acn/v1_0_0/acn.yaml new file mode 100644 index 0000000000..480d719e87 --- /dev/null +++ b/libs/go/aealite/protocols/acn/v1_0_0/acn.yaml @@ -0,0 +1,64 @@ +--- +name: acn +author: fetchai +version: 1.0.0 +description: The protocol used for envelope delivery on the ACN. +license: Apache-2.0 +aea_version: '>=1.0.0, <2.0.0' +protocol_specification_id: aea/acn:1.0.0 +speech_acts: + register: + record: ct:AgentRecord + lookup_request: + agent_address: pt:str + lookup_response: + record: ct:AgentRecord + aea_envelope: + envelope: pt:bytes + record: ct:AgentRecord + status: + body: ct:StatusBody +... +--- +ct:AgentRecord: + string service_id = 1; + string ledger_id = 2; + string address = 3; + string public_key = 4; + string peer_public_key = 5; + string signature = 6; + string not_before = 7; + string not_after = 8; +ct:StatusBody: | + enum StatusCodeEnum { + // common (0x) + SUCCESS = 0; + ERROR_UNSUPPORTED_VERSION = 1; + ERROR_UNEXPECTED_PAYLOAD = 2; + ERROR_GENERIC = 3; + ERROR_DECODE = 4; + // register (1x) + ERROR_WRONG_AGENT_ADDRESS = 10; + ERROR_WRONG_PUBLIC_KEY = 11; + ERROR_INVALID_PROOF = 12; + ERROR_UNSUPPORTED_LEDGER = 13; + // lookup & delivery (2x) + ERROR_UNKNOWN_AGENT_ADDRESS = 20; + ERROR_AGENT_NOT_READY = 21; + } + StatusCodeEnum code = 1; + repeated string msgs = 2; +... +--- +initiation: [register, lookup_request, aea_envelope] +reply: + register: [status] + lookup_request: [lookup_response, status] + aea_envelope: [status] + status: [] + lookup_response: [] +termination: [status, lookup_response] +roles: {node} +end_states: [successful, failed] +keep_terminal_state_dialogues: false +... From 9ee5cd160987db008c311da6ae6bd88a1cad30c2 Mon Sep 17 00:00:00 2001 From: Karrenbelt Date: Wed, 13 Jul 2022 02:59:20 +0200 Subject: [PATCH 2/4] fix: author and version to match package/protocols/acn --- libs/go/aealite/protocols/acn/v1_0_0/acn.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/go/aealite/protocols/acn/v1_0_0/acn.yaml b/libs/go/aealite/protocols/acn/v1_0_0/acn.yaml index 480d719e87..e977571ffd 100644 --- a/libs/go/aealite/protocols/acn/v1_0_0/acn.yaml +++ b/libs/go/aealite/protocols/acn/v1_0_0/acn.yaml @@ -1,7 +1,7 @@ --- name: acn -author: fetchai -version: 1.0.0 +author: valory +version: 1.1.0 description: The protocol used for envelope delivery on the ACN. license: Apache-2.0 aea_version: '>=1.0.0, <2.0.0' From c1de86ca98f0b95f10816692e843b55a2ef9aa6d Mon Sep 17 00:00:00 2001 From: Karrenbelt Date: Wed, 13 Jul 2022 02:59:47 +0200 Subject: [PATCH 3/4] fix: go_package to match aealite --- packages/valory/protocols/acn/acn.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/valory/protocols/acn/acn.proto b/packages/valory/protocols/acn/acn.proto index a2c2dc25de..79a6f699f2 100644 --- a/packages/valory/protocols/acn/acn.proto +++ b/packages/valory/protocols/acn/acn.proto @@ -2,6 +2,8 @@ syntax = "proto3"; package aea.aea.acn.v1_0_0; +option go_package = "libp2p_node/protocols/acn/v1_0_0"; + message AcnMessage{ // Custom Types From 2b030e184b648237f0fa742476dbaf410bc60a16 Mon Sep 17 00:00:00 2001 From: Karrenbelt Date: Wed, 13 Jul 2022 03:27:28 +0200 Subject: [PATCH 4/4] tests: aealite protocol matching --- packages/valory/protocols/acn/acn.proto | 2 -- .../test_packages/test_protocols/test_acn.py | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/valory/protocols/acn/acn.proto b/packages/valory/protocols/acn/acn.proto index 79a6f699f2..a2c2dc25de 100644 --- a/packages/valory/protocols/acn/acn.proto +++ b/packages/valory/protocols/acn/acn.proto @@ -2,8 +2,6 @@ syntax = "proto3"; package aea.aea.acn.v1_0_0; -option go_package = "libp2p_node/protocols/acn/v1_0_0"; - message AcnMessage{ // Custom Types diff --git a/tests/test_packages/test_protocols/test_acn.py b/tests/test_packages/test_protocols/test_acn.py index 7c2da5a563..ba0be3fc85 100644 --- a/tests/test_packages/test_protocols/test_acn.py +++ b/tests/test_packages/test_protocols/test_acn.py @@ -20,6 +20,9 @@ """This module contains the tests of the messages module.""" +import os +from pathlib import Path +from types import ModuleType from typing import Type from unittest import mock from unittest.mock import patch @@ -30,7 +33,9 @@ from aea.protocols.base import Message from aea.protocols.dialogue.base import Dialogue as BaseDialogue from aea.protocols.dialogue.base import DialogueLabel +from libs.go.aealite.protocols.acn import v1_0_0 as aealite_acn # type: ignore +from packages.valory.protocols import acn as package_acn from packages.valory.protocols.acn.dialogues import AcnDialogue as BaseAcnDialogue from packages.valory.protocols.acn.dialogues import AcnDialogues as BaseAcnDialogues from packages.valory.protocols.acn.message import AcnMessage @@ -256,3 +261,20 @@ def role_from_first_message( # pylint: disable=unused-argument role_from_first_message=role_from_first_message, dialogue_class=AcnDialogue, ) + + +def test_aealite_protocol_matching(): + """Ensure ACN protocol files are identical on aealite""" + + def get_path(module: ModuleType) -> Path: + return Path(os.path.sep.join(module.__package__.split("."))) # type: ignore + + acn_path, aealite_path = map(get_path, (package_acn, aealite_acn)) + + readme = (acn_path / "README.md").read_text() + yaml = (aealite_path / "acn.yaml").read_text() + assert yaml in readme + + go_package = """option go_package = "libp2p_node/protocols/acn/v1_0_0";\n\n""" + acn, aealite = ((p / "acn.proto").read_text() for p in (acn_path, aealite_path)) + assert acn == aealite.replace(go_package, "")