protoscan

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 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 service name → actual Go service name.
	ServiceClients map[string]string

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

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

GoNames holds the resolved Go identifiers for a proto package. Each map stores both the exact name and a lowercased key for case-insensitive fallback. Exact matches take priority to avoid collisions when two names differ only in casing (e.g., A2dp vs A2DP).

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.

func (GoNames) ResolveRPC

func (n GoNames) ResolveRPC(rpcName string) string

ResolveRPC returns the actual Go RPC method name.

func (GoNames) ResolveService

func (n GoNames) ResolveService(protoServiceName string) string

ResolveService returns the actual Go service name.

Jump to

Keyboard shortcuts

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