charmbracelet / wishlist

The SSH directory ✨

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

go module example failing

dezren39 opened this issue · comments

hello! the main.go example in _example didn't work for me, dependencies may have drifted and there was no mod or lock. specifically the charmbracelet/keygen library seems to be different? and then log doesnt have ln( like println( anymore. but something with the keygen changes i tried to do caused pointer errors once it compiled and i ran it. i get a segfault with both wsl ubuntu and windows 11. i havent tried a regular linux box.

user@laptop-framework:/mnt/c/Users/drewr/code/sources/launcher$ ./launcher
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x6b7e07]

goroutine 1 [running]:
github.com/charmbracelet/keygen.New({0xc0001482e0?, 0x0?}, {0xc00018be80, 0x2, 0x0?})
        /home/user/go/pkg/mod/github.com/charmbracelet/keygen@v0.5.0/keygen.go:167 +0x107
main.main()
        /mnt/c/Users/drewr/code/sources/launcher/main.go:20 +0xc5

  ❯ .\launcher.exe
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x1279927]

goroutine 1 [running]:
github.com/charmbracelet/keygen.New({0xc0001b4840?, 0x2?}, {0xc0001d1e80, 0x2, 0x0?})
        C:/Users/drewr/go/pkg/mod/github.com/charmbracelet/keygen@v0.5.0/keygen.go:167 +0x107
main.main()
        C:/Users/drewr/code/src/launcher/main.go:20 +0xc5

go 1.21.3

// ...
	k, err := keygen.New(filepath.Join(".wishlist", "server"), nil, keygen.WithKeyType(keygen.Ed25519)) //<-- this is different

// ...
			return wish.NewServer(
				wish.WithAddress(e.Address),
				wish.WithHostKeyPEM(k.RawProtectedPrivateKey()), // <-- this is different
				wish.WithPublicKeyAuth(func(ctx ssh.Context, key ssh.PublicKey) // ...

and then the log line changes