protoscan

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2026 License: CC0-1.0 Imports: 5 Imported by: 0

Documentation

Overview

Package protoscan reads compiled proto Go stubs to resolve actual Go names for services, RPCs, and messages. Protoc-gen-go may rename identifiers (e.g., P2p → P2P, A2dp → A2Dp) relative to the proto source names. This package bridges that gap.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoNames

type GoNames struct {
	// ServiceClients maps lowercase service name → actual Go service name.
	ServiceClients map[string]string

	// RPCMethods maps lowercase RPC name → actual Go RPC name.
	RPCMethods map[string]string

	// MessageTypes maps lowercase message name → actual Go message type name.
	MessageTypes map[string]string
}

GoNames holds the resolved Go identifiers for a proto package.

func Scan

func Scan(protoPackageDir string) GoNames

Scan reads the *_grpc.pb.go files in a proto package directory and extracts the actual Go names for services and RPC methods.

func (GoNames) ResolveMessage

func (n GoNames) ResolveMessage(msgName string) string

ResolveMessage returns the actual Go message type name (as generated by protoc-gen-go), falling back to the input if no resolution is found. Protoc-gen-go may rename identifiers (e.g., P2p -> P2P, A2dp -> A2Dp).

func (GoNames) ResolveRPC

func (n GoNames) ResolveRPC(rpcName string) string

ResolveRPC returns the actual Go RPC method name, falling back to the input if no resolution is found.

func (GoNames) ResolveService

func (n GoNames) ResolveService(protoServiceName string) string

ResolveService returns the actual Go service name, falling back to the input if no resolution is found.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL