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: socks5.rs
    path of file: ./repos/geph4-client/src/connect
    
    the code of the file until where you have to start completion: use std::{sync::atomic::Ordering, time::Duration};

use anyhow::Context;
use futures_util::TryFutureExt;
use psl::Psl;
use smol_timeout::TimeoutExt;
use std::net::{Ipv4Addr, SocketAddr, SocketAddrV4};

use crate::{
    china,
    connect::
    
pub async fn socks5_loop(ctx: ConnectContext) -> anyhow::Result<()> {
    let socks5_listener = smol::net::TcpListener::bind(ctx.opt.socks5_listen)
        .await
        .context("cannot bind socks5")?;
    log::debug!("socks5 started");
    loop {
        let (s5client, _) = socks5_listener
            .accept()
            .await
            .context("cannot accept socks5")?;

        smolscale::spawn(
            handle_socks5(ctx.clone(), s5client, ctx.opt.exclude_prc)
                .map_err(|e| log::debug!("local socks5 handler died with: {:?}", e)),
        )
        .detach()
    }
}