1// Copyright 2020 The Gitea Authors. All rights reserved.
2// SPDX-License-Identifier: MIT
3
4package proxyprotocol
5
6import "fmt"
7
8// ErrBadHeader is an error demonstrating a bad proxy header
9type ErrBadHeader struct {
10 Header []byte
11}
12
13func (e *ErrBadHeader) Error() string {
14 return fmt.Sprintf("Unexpected proxy header: %v", e.Header)
15}
16
17// ErrBadAddressType is an error demonstrating a bad proxy header with bad Address type
18type ErrBadAddressType struct {
19 Address string
20}
21
22func (e *ErrBadAddressType) Error() string {
23 return fmt.Sprintf("Unexpected proxy header address type: %s", e.Address)
24}
25
26// ErrBadRemote is an error demonstrating a bad proxy header with bad Remote
27type ErrBadRemote struct {
28 IP string
29 Port string
30}
31
32func (e *ErrBadRemote) Error() string {
33 return fmt.Sprintf("Unexpected proxy header remote IP and port: %s %s", e.IP, e.Port)
34}
35
36// ErrBadLocal is an error demonstrating a bad proxy header with bad Local
37type ErrBadLocal struct {
38 IP string
39 Port string
40}
41
42func (e *ErrBadLocal) Error() string {
43 return fmt.Sprintf("Unexpected proxy header local IP and port: %s %s", e.IP, e.Port)
44}