some more detailed info on how to use the scripts for development

This commit is contained in:
l0k18
2023-06-20 09:26:06 +01:00
parent 55f806c9f4
commit adae9504cd
9 changed files with 52 additions and 9 deletions

View File

@@ -14,5 +14,6 @@ var clientCommand = &cobra.Command{
Long: "Runs indra as a client, providing a wireguard tunnel and socks5 " +
"proxy as connectivity options",
Run: func(cmd *cobra.Command, args []string) {
},
}

View File

@@ -1,17 +1,39 @@
package relay
import (
"github.com/indra-labs/indra"
log2 "github.com/indra-labs/indra/pkg/proc/log"
"github.com/spf13/cobra"
)
var (
log = log2.GetLogger()
check = log.E.Chk
)
var (
wireguardEnable bool
wireguardCIDR string
socksEnable bool
socksListener string
)
func Init(c *cobra.Command) {
relayCommand.PersistentFlags().BoolVarP(&wireguardEnable, "wireguard",
"w", false, "enable wiregfuard tunnel")
relayCommand.PersistentFlags().BoolVarP(&socksEnable, "socks",
"s", false, "enable socks proxy")
relayCommand.PersistentFlags().StringVar(&socksListener, "socks-listener",
"localhost:8080", "set address for socks 5 proxy listener")
c.AddCommand(relayCommand)
}
var relayCommand = &cobra.Command{
Use: "relay",
Short: "run a relay",
Long: "Runs indra as a full relay, with optional client",
Run: func(cmd *cobra.Command, args []string) {
},
Long: "Runs indra as a full relay, with optional client.",
Run: func(cmd *cobra.Command, args []string) {
log.I.Ln(log2.App.Load(), indra.SemVer)
},
}

View File

@@ -1,4 +0,0 @@
#!/usr/bin/zsh
cd /home/loki/work/loki/indra-labs/indra
export PATH=/home/loki/work/loki/indra-labs/indra/scripts:$PATH
zsh

7
scripts/cdwork.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/zsh
# populate ~/.workpath thus: `cd path/to/repo/root; pwd>~/.workpath
export INDRAROOT=$(cat ~/.workpath)
export PATH=$INDRAROOT/scripts:$PATH
# put the path of the root of the repository in ./scripts/path
cd $INDRAROOT
zsh

11
scripts/readme.md Normal file
View File

@@ -0,0 +1,11 @@
# scripts
populate ~/.workpath thus: `cd path/to/repo/root; pwd>~/.workpath`
add this to your `~/.bashrc` or `~/.zshrc`:
export PATH=$(cat ~/.workpath)/scripts:$HOME/sdk/go1.19.10/bin:$PATH
export GOBIN=$HOME/.local/bin
`source` the `rc` file or open a new terminal session and type `cdwork.sh` and you will have a number of useful commands
that handle paths and special build parameters to make the code locations work without hard coding them anywhere.

3
scripts/run.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env zsh
reset
go run -tags local -gcflags "all=-trimpath=$INDRAROOT" $1 --logs-level=trace $2 $3 $4 $5

View File

@@ -1,3 +1,3 @@
#!/usr/bin/env zsh
reset
go test -v -tags local -gcflags "all=-trimpath=/home/loki/work/loki/indra-labs/indra" $1 $2 $3 $4 $5
go test -v -tags local -gcflags "all=-trimpath=$INDRAROOT" $1 $2 $3 $4 $5

View File

@@ -1,3 +1,3 @@
#!/usr/bin/env zsh
cd pkg
go test -v -tags local -gcflags "all=-trimpath=/home/loki/work/loki/indra-labs/indra" ./...
go test -v -tags local -gcflags "all=-trimpath=$INDRAROOT" ./...

3
scripts/trace.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env zsh
reset
go run -tags local -gcflags "all=-trimpath=$INDRAROOT" $1 $2 $3 $4 $5