network

package
v2.8.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package network provides network utilities for the 3x-ui web panel, including automatic HTTP to HTTPS redirection functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAutoHttpsConn

func NewAutoHttpsConn(conn net.Conn) net.Conn

NewAutoHttpsConn creates a new AutoHttpsConn that wraps the given connection. It enables automatic redirection of HTTP requests to HTTPS.

func NewAutoHttpsListener

func NewAutoHttpsListener(listener net.Listener) net.Listener

NewAutoHttpsListener creates a new AutoHttpsListener that wraps the given listener. It enables automatic redirection of HTTP requests to HTTPS for all accepted connections.

Types

type AutoHttpsConn

type AutoHttpsConn struct {
	net.Conn
	// contains filtered or unexported fields
}

AutoHttpsConn wraps a net.Conn to provide automatic HTTP to HTTPS redirection. It intercepts the first read to detect HTTP requests and responds with a 307 redirect to the HTTPS equivalent URL. Subsequent reads work normally for HTTPS connections.

func (*AutoHttpsConn) Read

func (c *AutoHttpsConn) Read(buf []byte) (int, error)

Read implements the net.Conn Read method with automatic HTTPS redirection. On the first read, it checks if the request is HTTP and redirects to HTTPS if so. Subsequent reads work normally.

type AutoHttpsListener

type AutoHttpsListener struct {
	net.Listener
}

AutoHttpsListener wraps a net.Listener to provide automatic HTTPS redirection. It returns AutoHttpsConn connections that handle HTTP to HTTPS redirection.

func (*AutoHttpsListener) Accept

func (l *AutoHttpsListener) Accept() (net.Conn, error)

Accept implements the net.Listener Accept method. It accepts connections and wraps them with AutoHttpsConn for HTTPS redirection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL