Documentation ¶
Overview ¶
Package nets 网络相关.
包括 支持json和protobuf的简单web服务,
Index ¶
- Constants
- func GetIP() []byte
- func IsJSON(req *http.Request) bool
- func WithLogging(handler http.Handler) http.Handler
- func WithNotFound(path string, handler http.Handler) http.Handler
- func WithRecover(handler Handler) http.Handler
- func Write(writer io.Writer, msg proto.Message, isJSON bool)
- type Dirs
- func (p Dirs) Close() error
- func (p Dirs) IsDir() bool
- func (p Dirs) ModTime() time.Time
- func (p Dirs) Mode() fs.FileMode
- func (p Dirs) Name() string
- func (p Dirs) Open(name string) (http.File, error)
- func (p Dirs) Read(data []byte) (int, error)
- func (p Dirs) Readdir(count int) ([]fs.FileInfo, error)
- func (p Dirs) Seek(offset int64, whence int) (int64, error)
- func (p Dirs) Size() int64
- func (p Dirs) Stat() (fs.FileInfo, error)
- func (p Dirs) Sys() any
- type Handler
- type Service
Examples ¶
Constants ¶
View Source
const (
ContentType = "Content-Type"
)
Variables ¶
This section is empty.
Functions ¶
func GetIP ¶ added in v0.2.15
func GetIP() []byte
GetIP 获取IP地址.
Example ¶
package main import ( "fmt" "github.com/xuender/oils/nets" ) func main() { ip := nets.GetIP() fmt.Println(ip) }
Output:
func WithRecover ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.