You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: main.go
    path of file: ./repos/lotus/cmd/lotus-worker
    
    the code of the file until where you have to start completion: package main

import (
	"context"
	"encoding/json"
	"fmt"
	"net"
    
func extractRoutableIP(timeout time.Duration) (string, error) {
	minerMultiAddrKey := "MINER_API_INFO"
	deprecatedMinerMultiAddrKey := "STORAGE_API_INFO"
	env, ok := os.LookupEnv(minerMultiAddrKey)
	if !ok {
		_, ok = os.LookupEnv(deprecatedMinerMultiAddrKey)
		if ok {
			log.Warnf("Using a deprecated env(%s) value, please use env(%s) instead.", deprecatedMinerMultiAddrKey, minerMultiAddrKey)
		}
		return "", xerrors.New("MINER_API_INFO environment variable required to extract IP")
	}

	// Splitting the env to separate the JWT from the multiaddress
	splitEnv := strings.SplitN(env, ":", 2)
	if len(splitEnv) < 2 {
		return "", xerrors.Errorf("invalid MINER_API_INFO format")
	}
	// Only take the multiaddress part
	maddrStr := splitEnv[1]

	maddr, err := multiaddr.NewMultiaddr(maddrStr)
	if err != nil {
		return "", err
	}

	minerIP, _ := maddr.ValueForProtocol(multiaddr.P_IP6)
	if minerIP == "" {
		minerIP, _ = maddr.ValueForProtocol(multiaddr.P_IP4)
	}
	minerPort, _ := maddr.ValueForProtocol(multiaddr.P_TCP)

	// Format the address appropriately
	addressToDial := net.JoinHostPort(minerIP, minerPort)

	conn, err := net.DialTimeout("tcp", addressToDial, timeout)
	if err != nil {
		return "", err
	}

	defer func() {
		if cerr := conn.Close(); cerr != nil {
			log.Errorf("Error closing connection: %v", cerr)
		}
	}()

	localAddr := conn.LocalAddr().(*net.TCPAddr)
	return localAddr.IP.String(), nil
}