1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 18:17:52 -05:00
v2fly/common/log/access.go

34 lines
652 B
Go
Raw Normal View History

2017-12-10 16:48:28 -05:00
package log
2017-12-19 15:28:12 -05:00
import (
"strings"
"v2ray.com/core/common/serial"
)
2017-12-10 16:48:28 -05:00
type AccessStatus string
const (
AccessAccepted = AccessStatus("accepted")
AccessRejected = AccessStatus("rejected")
)
type AccessMessage struct {
From interface{}
To interface{}
Status AccessStatus
Reason interface{}
}
2017-12-19 15:28:12 -05:00
func (m *AccessMessage) String() string {
2018-10-01 06:54:06 -04:00
builder := strings.Builder{}
builder.WriteString(serial.ToString(m.From))
builder.WriteByte(' ')
builder.WriteString(string(m.Status))
builder.WriteByte(' ')
builder.WriteString(serial.ToString(m.To))
builder.WriteByte(' ')
builder.WriteString(serial.ToString(m.Reason))
return builder.String()
2017-12-19 15:28:12 -05:00
}