https://github.com/brettbates/p4broker-reader
A golang reader for the Perforce/Helix broker filter output
https://github.com/brettbates/p4broker-reader
broker golang helix p4broker perforce
Last synced: 4 months ago
JSON representation
A golang reader for the Perforce/Helix broker filter output
- Host: GitHub
- URL: https://github.com/brettbates/p4broker-reader
- Owner: brettbates
- License: mit
- Created: 2021-01-26T12:12:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-28T09:11:41.000Z (over 5 years ago)
- Last Synced: 2024-06-20T15:54:41.454Z (almost 2 years ago)
- Topics: broker, golang, helix, p4broker, perforce
- Language: Go
- Homepage:
- Size: 2.26 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A reader for the Perforce/helix broker filter output.
For example if you have a p4broker.conf stanza like so:
```
command: access
{
action=filter;
execute=/path/to/go/program;
}
```
You can use this p4broker-reader.Read() within the receiving go program to get the output dictionary as a map[string]string.
And example dictionary is like so:
```
brokerListenPort: 1998
brokerTargetPort: localhost:1999
command: access
clientProg: p4
clientVersion: 2020.2/LINUX26X86_64/2057778
clientProtocol: 89
apiProtocol: 99999
workspace: NP-B-BATES
user: brett.bates
clientIp: 127.0.0.1
clientHost: ahost
cwd: /home/brett/scratch/broker
clientPort: 1998
argCount: 2
Arg0: read
Arg1: //path/to/file
```
Example usage:
```go
// Pass in an io.Reader, though you probably want os.Stdin to get input from p4broker
res, err := Read(os.Stdin)
if err != nil {
log.Fatalf("%v", err)
}
log.Printf("%v", res["Arg0"])
```