Ask questionsSegmentation fault when running example client on linux

linux 4.19, tor I was trying to run the example client code to create communicating hidden services, but i couldn't get the example code to run on my manjaro linux.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x63cf53]

goroutine 24 [running]:*socks5).Dial(0xc00009ec30, 0x6f2455, 0x3, 0xc0000966a0, 0xf, 0xf, 0x0, 0x28a, 0x0)
	/home/h/go/src/ +0x63*Dialer).DialContext.func1(0xc000085180, 0x6f2455, 0x3, 0xc0000966a0, 0xf, 0xc00009aa80, 0x754200, 0xc000096010, 0xc00009aae0)
	/home/h/go/src/ +0x7e
created by*Dialer).DialContext
	/home/h/go/src/ +0xfa
exit status 2

the code was:

package main

import (


func main() {
	if err := run(); err != nil {

func run() error {
	// Start tor with default config (can set start conf's DebugWriter to os.Stdout for debug logs)
	fmt.Println("Starting tor and fetching title of https://eludemaillhqfkh5.onion, please wait a few seconds...")
	t, err := tor.Start(nil, nil)
	if err != nil {
		return err
	defer t.Close()
	// Wait at most a minute to start network and get
	dialCtx, dialCancel := context.WithTimeout(context.Background(), time.Minute)
	defer dialCancel()
	// Make connection
	dialer, err := t.Dialer(dialCtx, nil)
	if err != nil {
		return err
	httpClient := &http.Client{Transport: &http.Transport{DialContext: dialer.DialContext}}
	// Get /
	resp, err := httpClient.Get("")
	if err != nil {
		return err
	defer resp.Body.Close()
	if err != nil {
		return err
	bodyBytes, err := ioutil.ReadAll(resp.Body)
	return nil

A slight variation on the example client.


Answer questions cretz

Closing old issue. Let mw know if this issue persists.


Related questions

No questions were found.
Github User Rank List