forked from lug/matterbridge
		
	Compare commits
	
		
			18 Commits
		
	
	
		
			v1.19.0
			...
			addtengodo
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					c1c732b87a | ||
| 
						 | 
					b24e1bafa1 | ||
| 
						 | 
					64b899ac89 | ||
| 
						 | 
					aa274e5ab7 | ||
| 
						 | 
					7b3eaf3ccf | ||
| 
						 | 
					1a5353d768 | ||
| 
						 | 
					eff41759bc | ||
| 
						 | 
					c23252ab53 | ||
| 
						 | 
					1a3c57a031 | ||
| 
						 | 
					4cc2c914e6 | ||
| 
						 | 
					cbb46293ab | ||
| 
						 | 
					765e00c949 | ||
| 
						 | 
					662359908b | ||
| 
						 | 
					0d99766686 | ||
| 
						 | 
					ae3bc3358b | ||
| 
						 | 
					1e0b4532bd | ||
| 
						 | 
					4f8b19c686 | ||
| 
						 | 
					84ab223b81 | 
@@ -153,7 +153,7 @@ See <https://github.com/42wim/matterbridge/wiki>
 | 
			
		||||
 | 
			
		||||
### Binaries
 | 
			
		||||
 | 
			
		||||
- Latest stable release [v1.19.0](https://github.com/42wim/matterbridge/releases/latest)
 | 
			
		||||
- Latest stable release [v1.20.0](https://github.com/42wim/matterbridge/releases/latest)
 | 
			
		||||
- Development releases (follows master) can be downloaded [here](https://github.com/42wim/matterbridge/actions) selecting the latest green build and then artifacts.
 | 
			
		||||
 | 
			
		||||
To install or upgrade just download the latest [binary](https://github.com/42wim/matterbridge/releases/latest) and follow the instructions on the [howto](https://github.com/42wim/matterbridge/wiki/How-to-create-your-config) for a step by step walkthrough for creating your configuration.
 | 
			
		||||
@@ -352,7 +352,7 @@ Matterbridge wouldn't exist without these libraries:
 | 
			
		||||
[mb-mattermost]: https://framateam.org/signup_user_complete/?id=tfqm33ggop8x3qgu4boeieta6e
 | 
			
		||||
[mb-msteams]: https://teams.microsoft.com/join/hj92x75gd3y7
 | 
			
		||||
[mb-rocketchat]: https://open.rocket.chat/channel/matterbridge
 | 
			
		||||
[mb-slack]: https://join.slack.com/matterbridgechat/shared_invite/MjEwODMxNjU1NDMwLTE0OTk2MTU3NTMtMzZkZmRiNDZhOA
 | 
			
		||||
[mb-slack]: https://join.slack.com/t/matterbridgechat/shared_invite/zt-2ourq2h2-7YvyYBq2WFGC~~zEzA68_Q
 | 
			
		||||
[mb-telegram]: https://t.me/Matterbridge
 | 
			
		||||
[mb-twitch]: https://www.twitch.tv/matterbridge
 | 
			
		||||
[mb-whatsapp]: https://www.whatsapp.com/
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,7 @@ const (
 | 
			
		||||
	EventAPIConnected      = "api_connected"
 | 
			
		||||
	EventUserTyping        = "user_typing"
 | 
			
		||||
	EventGetChannelMembers = "get_channel_members"
 | 
			
		||||
	EventNoticeIRC         = "notice_irc"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Message struct {
 | 
			
		||||
@@ -117,7 +118,7 @@ type Protocol struct {
 | 
			
		||||
	NicksPerRow            int        // mattermost, slack
 | 
			
		||||
	NoHomeServerSuffix     bool       // matrix
 | 
			
		||||
	NoSendJoinPart         bool       // all protocols
 | 
			
		||||
	NoTLS                  bool       // mattermost
 | 
			
		||||
	NoTLS                  bool       // mattermost, xmpp
 | 
			
		||||
	Password               string     // IRC,mattermost,XMPP,matrix
 | 
			
		||||
	PrefixMessagesWithNick bool       // mattemost, slack
 | 
			
		||||
	PreserveThreading      bool       // slack
 | 
			
		||||
@@ -154,7 +155,7 @@ type Protocol struct {
 | 
			
		||||
	UseTLS                 bool       // IRC
 | 
			
		||||
	UseDiscriminator       bool       // discord
 | 
			
		||||
	UseFirstName           bool       // telegram
 | 
			
		||||
	UseUserName            bool       // discord
 | 
			
		||||
	UseUserName            bool       // discord, matrix
 | 
			
		||||
	UseInsecureURL         bool       // telegram
 | 
			
		||||
	VerboseJoinPart        bool       // IRC
 | 
			
		||||
	WebhookBindAddress     string     // mattermost, slack
 | 
			
		||||
 
 | 
			
		||||
@@ -34,8 +34,6 @@ type Bdiscord struct {
 | 
			
		||||
	membersMutex  sync.RWMutex
 | 
			
		||||
	userMemberMap map[string]*discordgo.Member
 | 
			
		||||
	nickMemberMap map[string]*discordgo.Member
 | 
			
		||||
	webhookCache  map[string]string
 | 
			
		||||
	webhookMutex  sync.RWMutex
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func New(cfg *bridge.Config) bridge.Bridger {
 | 
			
		||||
@@ -43,7 +41,6 @@ func New(cfg *bridge.Config) bridge.Bridger {
 | 
			
		||||
	b.userMemberMap = make(map[string]*discordgo.Member)
 | 
			
		||||
	b.nickMemberMap = make(map[string]*discordgo.Member)
 | 
			
		||||
	b.channelInfoMap = make(map[string]*config.ChannelInfo)
 | 
			
		||||
	b.webhookCache = make(map[string]string)
 | 
			
		||||
	if b.GetString("WebhookURL") != "" {
 | 
			
		||||
		b.Log.Debug("Configuring Discord Incoming Webhook")
 | 
			
		||||
		b.webhookID, b.webhookToken = b.splitURL(b.GetString("WebhookURL"))
 | 
			
		||||
@@ -145,12 +142,16 @@ func (b *Bdiscord) Connect() error {
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		b.canEditWebhooks = len(channelsDenied) == 0
 | 
			
		||||
		if b.canEditWebhooks {
 | 
			
		||||
			b.Log.Info("Can manage webhooks; will edit channel for global webhook on send")
 | 
			
		||||
		} else {
 | 
			
		||||
			b.Log.Warn("Can't manage webhooks; won't edit channel for global webhook on send")
 | 
			
		||||
			b.Log.Warn("Can't manage webhooks in channels: ", strings.Join(channelsDenied, ", "))
 | 
			
		||||
		}
 | 
			
		||||
		b.canEditWebhooks = false
 | 
			
		||||
		b.Log.Info("Webhook editing is disabled because of ratelimit issues")
 | 
			
		||||
		/*
 | 
			
		||||
			if b.canEditWebhooks {
 | 
			
		||||
				b.Log.Info("Can manage webhooks; will edit channel for global webhook on send")
 | 
			
		||||
			} else {
 | 
			
		||||
				b.Log.Warn("Can't manage webhooks; won't edit channel for global webhook on send")
 | 
			
		||||
				b.Log.Warn("Can't manage webhooks in channels: ", strings.Join(channelsDenied, ", "))
 | 
			
		||||
			}
 | 
			
		||||
		*/
 | 
			
		||||
	}
 | 
			
		||||
	b.channelsMutex.RUnlock()
 | 
			
		||||
 | 
			
		||||
@@ -191,8 +192,6 @@ func (b *Bdiscord) JoinChannel(channel config.ChannelInfo) error {
 | 
			
		||||
func (b *Bdiscord) Send(msg config.Message) (string, error) {
 | 
			
		||||
	b.Log.Debugf("=> Receiving %#v", msg)
 | 
			
		||||
 | 
			
		||||
	origMsgID := msg.ID
 | 
			
		||||
 | 
			
		||||
	channelID := b.getChannelID(msg.Channel)
 | 
			
		||||
	if channelID == "" {
 | 
			
		||||
		return "", fmt.Errorf("Could not find channelID for %v", msg.Channel)
 | 
			
		||||
@@ -233,18 +232,6 @@ func (b *Bdiscord) Send(msg config.Message) (string, error) {
 | 
			
		||||
			return "", nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// If we are editing a message, delete the old message
 | 
			
		||||
		if msg.ID != "" {
 | 
			
		||||
			msg.ID = b.getCacheID(msg.ID)
 | 
			
		||||
			b.Log.Debugf("Deleting edited webhook message")
 | 
			
		||||
			err := b.c.ChannelMessageDelete(channelID, msg.ID)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				b.Log.Errorf("Could not delete edited webhook message: %s", err)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		b.Log.Debugf("Broadcasting using Webhook")
 | 
			
		||||
 | 
			
		||||
		// skip empty messages
 | 
			
		||||
		if msg.Text == "" && (msg.Extra == nil || len(msg.Extra["file"]) == 0) {
 | 
			
		||||
			b.Log.Debugf("Skipping empty message %#v", msg)
 | 
			
		||||
@@ -257,11 +244,25 @@ func (b *Bdiscord) Send(msg config.Message) (string, error) {
 | 
			
		||||
		if len(msg.Username) > 32 {
 | 
			
		||||
			msg.Username = msg.Username[0:32]
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if msg.ID != "" {
 | 
			
		||||
			b.Log.Debugf("Editing webhook message")
 | 
			
		||||
			uri := discordgo.EndpointWebhookToken(wID, wToken) + "/messages/" + msg.ID
 | 
			
		||||
			_, err := b.c.RequestWithBucketID("PATCH", uri, discordgo.WebhookParams{
 | 
			
		||||
				Content:  msg.Text,
 | 
			
		||||
				Username: msg.Username,
 | 
			
		||||
			}, discordgo.EndpointWebhookToken("", ""))
 | 
			
		||||
			if err == nil {
 | 
			
		||||
				return msg.ID, nil
 | 
			
		||||
			}
 | 
			
		||||
			b.Log.Errorf("Could not edit webhook message: %s", err)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		b.Log.Debugf("Broadcasting using Webhook")
 | 
			
		||||
 | 
			
		||||
		// if we have a global webhook for this Discord account, and permission
 | 
			
		||||
		// to modify webhooks (previously verified), then set its channel to
 | 
			
		||||
		// the message channel before using it
 | 
			
		||||
		// TODO: this isn't necessary if the last message from this webhook was
 | 
			
		||||
		// sent to the current channel
 | 
			
		||||
		// the message channel before using it.
 | 
			
		||||
		if isGlobalWebhook && b.canEditWebhooks {
 | 
			
		||||
			b.Log.Debugf("Setting webhook channel to \"%s\"", msg.Channel)
 | 
			
		||||
			_, err := b.c.WebhookEdit(wID, "", "", channelID)
 | 
			
		||||
@@ -280,7 +281,6 @@ func (b *Bdiscord) Send(msg config.Message) (string, error) {
 | 
			
		||||
			return "", nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		b.updateCacheID(origMsgID, msg.ID)
 | 
			
		||||
		return msg.ID, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -291,7 +291,6 @@ func (b *Bdiscord) Send(msg config.Message) (string, error) {
 | 
			
		||||
		if msg.ID == "" {
 | 
			
		||||
			return "", nil
 | 
			
		||||
		}
 | 
			
		||||
		msg.ID = b.getCacheID(msg.ID)
 | 
			
		||||
		err := b.c.ChannelMessageDelete(channelID, msg.ID)
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -209,40 +209,6 @@ func (b *Bdiscord) splitURL(url string) (string, string) {
 | 
			
		||||
	return webhookURLSplit[webhookIdxID], webhookURLSplit[webhookIdxToken]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// getcacheID tries to find a corresponding msgID in the webhook cache.
 | 
			
		||||
// if not found returns the original request.
 | 
			
		||||
func (b *Bdiscord) getCacheID(msgID string) string {
 | 
			
		||||
	b.webhookMutex.RLock()
 | 
			
		||||
	defer b.webhookMutex.RUnlock()
 | 
			
		||||
	for k, v := range b.webhookCache {
 | 
			
		||||
		if msgID == k {
 | 
			
		||||
			return v
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return msgID
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// updateCacheID updates the cache so that the newID takes the place of
 | 
			
		||||
// the original ID. This is used for edit/deletes in combination with webhooks
 | 
			
		||||
// as editing a message via webhook means deleting the message and creating a
 | 
			
		||||
// new message (with a new ID). This ID needs to be set instead of the original ID
 | 
			
		||||
func (b *Bdiscord) updateCacheID(origID, newID string) {
 | 
			
		||||
	b.webhookMutex.Lock()
 | 
			
		||||
	match := false
 | 
			
		||||
	for k, v := range b.webhookCache {
 | 
			
		||||
		if v == origID {
 | 
			
		||||
			delete(b.webhookCache, k)
 | 
			
		||||
			b.webhookCache[origID] = newID
 | 
			
		||||
			match = true
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if !match && origID != "" {
 | 
			
		||||
		b.webhookCache[origID] = newID
 | 
			
		||||
	}
 | 
			
		||||
	b.webhookMutex.Unlock()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func enumerateUsernames(s string) []string {
 | 
			
		||||
	onlySpace := true
 | 
			
		||||
	for _, r := range s {
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,11 @@ import (
 | 
			
		||||
 | 
			
		||||
	"golang.org/x/image/webp"
 | 
			
		||||
 | 
			
		||||
	"github.com/42wim/matterbridge/bridge"
 | 
			
		||||
	"github.com/42wim/matterbridge/bridge/config"
 | 
			
		||||
	"github.com/42wim/matterbridge/internal"
 | 
			
		||||
	"github.com/d5/tengo/v2"
 | 
			
		||||
	"github.com/d5/tengo/v2/stdlib"
 | 
			
		||||
	"github.com/gomarkdown/markdown"
 | 
			
		||||
	"github.com/gomarkdown/markdown/html"
 | 
			
		||||
	"github.com/gomarkdown/markdown/parser"
 | 
			
		||||
@@ -114,6 +118,62 @@ func GetAvatar(av map[string]string, userid string, general *config.Protocol) st
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func handleDownloadTengo(br *bridge.Bridge, msg *config.Message, name string, size int64, general *config.Protocol) (bool, error) {
 | 
			
		||||
	var (
 | 
			
		||||
		res  []byte
 | 
			
		||||
		err  error
 | 
			
		||||
		drop bool
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	filename := br.GetString("tengo.download")
 | 
			
		||||
 | 
			
		||||
	if filename == "" {
 | 
			
		||||
		res, err = internal.Asset("tengo/download.tengo")
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return drop, err
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		res, err = ioutil.ReadFile(filename)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return drop, err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	s := tengo.NewScript(res)
 | 
			
		||||
 | 
			
		||||
	s.SetImports(stdlib.GetModuleMap(stdlib.AllModuleNames()...))
 | 
			
		||||
 | 
			
		||||
	_ = s.Add("inAccount", msg.Account)
 | 
			
		||||
	_ = s.Add("inProtocol", msg.Protocol)
 | 
			
		||||
	_ = s.Add("inChannel", msg.Channel)
 | 
			
		||||
	_ = s.Add("inGateway", msg.Gateway)
 | 
			
		||||
	_ = s.Add("inEvent", msg.Event)
 | 
			
		||||
	_ = s.Add("outAccount", br.Account)
 | 
			
		||||
	_ = s.Add("outProtocol", br.Protocol)
 | 
			
		||||
	_ = s.Add("outChannel", msg.Channel)
 | 
			
		||||
	_ = s.Add("outEvent", msg.Event)
 | 
			
		||||
	_ = s.Add("msgText", msg.Text)
 | 
			
		||||
	_ = s.Add("msgUsername", msg.Username)
 | 
			
		||||
	_ = s.Add("msgDrop", drop)
 | 
			
		||||
	_ = s.Add("downloadName", name)
 | 
			
		||||
	_ = s.Add("downloadSize", size)
 | 
			
		||||
 | 
			
		||||
	c, err := s.Compile()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return drop, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := c.Run(); err != nil {
 | 
			
		||||
		return drop, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	drop = c.Get("msgDrop").Bool()
 | 
			
		||||
	msg.Text = c.Get("msgText").String()
 | 
			
		||||
	msg.Username = c.Get("msgUsername").String()
 | 
			
		||||
 | 
			
		||||
	return drop, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// HandleDownloadSize checks a specified filename against the configured download blacklist
 | 
			
		||||
// and checks a specified file-size against the configure limit.
 | 
			
		||||
func HandleDownloadSize(logger *logrus.Entry, msg *config.Message, name string, size int64, general *config.Protocol) error {
 | 
			
		||||
 
 | 
			
		||||
@@ -170,7 +170,14 @@ func (b *Birc) handlePrivMsg(client *girc.Client, event girc.Event) {
 | 
			
		||||
	if b.skipPrivMsg(event) {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	rmsg := config.Message{Username: event.Source.Name, Channel: strings.ToLower(event.Params[0]), Account: b.Account, UserID: event.Source.Ident + "@" + event.Source.Host}
 | 
			
		||||
 | 
			
		||||
	rmsg := config.Message{
 | 
			
		||||
		Username: event.Source.Name,
 | 
			
		||||
		Channel:  strings.ToLower(event.Params[0]),
 | 
			
		||||
		Account:  b.Account,
 | 
			
		||||
		UserID:   event.Source.Ident + "@" + event.Source.Host,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	b.Log.Debugf("== Receiving PRIVMSG: %s %s %#v", event.Source.Name, event.Last(), event)
 | 
			
		||||
 | 
			
		||||
	// set action event
 | 
			
		||||
@@ -178,6 +185,11 @@ func (b *Birc) handlePrivMsg(client *girc.Client, event girc.Event) {
 | 
			
		||||
		rmsg.Event = config.EventUserAction
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// set NOTICE event
 | 
			
		||||
	if event.Command == "NOTICE" {
 | 
			
		||||
		rmsg.Event = config.EventNoticeIRC
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// strip action, we made an event if it was an action
 | 
			
		||||
	rmsg.Text += event.StripAction()
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -212,9 +212,14 @@ func (b *Birc) doSend() {
 | 
			
		||||
			colorCode := checksum%14 + 2 // quick fix - prevent white or black color codes
 | 
			
		||||
			username = fmt.Sprintf("\x03%02d%s\x0F", colorCode, msg.Username)
 | 
			
		||||
		}
 | 
			
		||||
		if msg.Event == config.EventUserAction {
 | 
			
		||||
 | 
			
		||||
		switch msg.Event {
 | 
			
		||||
		case config.EventUserAction:
 | 
			
		||||
			b.i.Cmd.Action(msg.Channel, username+msg.Text)
 | 
			
		||||
		} else {
 | 
			
		||||
		case config.EventNoticeIRC:
 | 
			
		||||
			b.Log.Debugf("Sending notice to channel %s", msg.Channel)
 | 
			
		||||
			b.i.Cmd.Notice(msg.Channel, username+msg.Text)
 | 
			
		||||
		default:
 | 
			
		||||
			b.Log.Debugf("Sending to channel %s", msg.Channel)
 | 
			
		||||
			b.i.Cmd.Message(msg.Channel, username+msg.Text)
 | 
			
		||||
		}
 | 
			
		||||
@@ -246,6 +251,13 @@ func (b *Birc) getClient() (*girc.Client, error) {
 | 
			
		||||
		debug = b.Log.Writer()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	pingDelay, err := time.ParseDuration(b.GetString("pingdelay"))
 | 
			
		||||
	if err != nil || pingDelay == 0 {
 | 
			
		||||
		pingDelay = time.Minute
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	b.Log.Debugf("setting pingdelay to %s", pingDelay)
 | 
			
		||||
 | 
			
		||||
	i := girc.New(girc.Config{
 | 
			
		||||
		Server:     server,
 | 
			
		||||
		ServerPass: b.GetString("Password"),
 | 
			
		||||
@@ -255,7 +267,7 @@ func (b *Birc) getClient() (*girc.Client, error) {
 | 
			
		||||
		Name:       b.GetString("Nick"),
 | 
			
		||||
		SSL:        b.GetBool("UseTLS"),
 | 
			
		||||
		TLSConfig:  &tls.Config{InsecureSkipVerify: b.GetBool("SkipTLSVerify"), ServerName: server}, //nolint:gosec
 | 
			
		||||
		PingDelay:  time.Minute,
 | 
			
		||||
		PingDelay:  pingDelay,
 | 
			
		||||
		// skip gIRC internal rate limiting, since we have our own throttling
 | 
			
		||||
		AllowFlood: true,
 | 
			
		||||
		Debug:      debug,
 | 
			
		||||
@@ -284,7 +296,7 @@ func (b *Birc) skipPrivMsg(event girc.Event) bool {
 | 
			
		||||
	b.Nick = b.i.GetNick()
 | 
			
		||||
 | 
			
		||||
	// freenode doesn't send 001 as first reply
 | 
			
		||||
	if event.Command == "NOTICE" {
 | 
			
		||||
	if event.Command == "NOTICE" && len(event.Params) != 2 {
 | 
			
		||||
		return true
 | 
			
		||||
	}
 | 
			
		||||
	// don't forward queries to the bot
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										166
									
								
								bridge/matrix/helpers.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										166
									
								
								bridge/matrix/helpers.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,166 @@
 | 
			
		||||
package bmatrix
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"errors"
 | 
			
		||||
	"html"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	matrix "github.com/matrix-org/gomatrix"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func newMatrixUsername(username string) *matrixUsername {
 | 
			
		||||
	mUsername := new(matrixUsername)
 | 
			
		||||
 | 
			
		||||
	// check if we have a </tag>. if we have, we don't escape HTML. #696
 | 
			
		||||
	if htmlTag.MatchString(username) {
 | 
			
		||||
		mUsername.formatted = username
 | 
			
		||||
		// remove the HTML formatting for beautiful push messages #1188
 | 
			
		||||
		mUsername.plain = htmlReplacementTag.ReplaceAllString(username, "")
 | 
			
		||||
	} else {
 | 
			
		||||
		mUsername.formatted = html.EscapeString(username)
 | 
			
		||||
		mUsername.plain = username
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return mUsername
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// getRoomID retrieves a matching room ID from the channel name.
 | 
			
		||||
func (b *Bmatrix) getRoomID(channel string) string {
 | 
			
		||||
	b.RLock()
 | 
			
		||||
	defer b.RUnlock()
 | 
			
		||||
	for ID, name := range b.RoomMap {
 | 
			
		||||
		if name == channel {
 | 
			
		||||
			return ID
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// interface2Struct marshals and immediately unmarshals an interface.
 | 
			
		||||
// Useful for converting map[string]interface{} to a struct.
 | 
			
		||||
func interface2Struct(in interface{}, out interface{}) error {
 | 
			
		||||
	jsonObj, err := json.Marshal(in)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err //nolint:wrapcheck
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return json.Unmarshal(jsonObj, out)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// getDisplayName retrieves the displayName for mxid, querying the homserver if the mxid is not in the cache.
 | 
			
		||||
func (b *Bmatrix) getDisplayName(mxid string) string {
 | 
			
		||||
	if b.GetBool("UseUserName") {
 | 
			
		||||
		return mxid[1:]
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	b.RLock()
 | 
			
		||||
	if val, present := b.NicknameMap[mxid]; present {
 | 
			
		||||
		b.RUnlock()
 | 
			
		||||
 | 
			
		||||
		return val.displayName
 | 
			
		||||
	}
 | 
			
		||||
	b.RUnlock()
 | 
			
		||||
 | 
			
		||||
	displayName, err := b.mc.GetDisplayName(mxid)
 | 
			
		||||
	var httpError *matrix.HTTPError
 | 
			
		||||
	if errors.As(err, &httpError) {
 | 
			
		||||
		b.Log.Warnf("Couldn't retrieve the display name for %s", mxid)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return b.cacheDisplayName(mxid, mxid[1:])
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return b.cacheDisplayName(mxid, displayName.DisplayName)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// cacheDisplayName stores the mapping between a mxid and a display name, to be reused later without performing a query to the homserver.
 | 
			
		||||
// Note that old entries are cleaned when this function is called.
 | 
			
		||||
func (b *Bmatrix) cacheDisplayName(mxid string, displayName string) string {
 | 
			
		||||
	now := time.Now()
 | 
			
		||||
 | 
			
		||||
	// scan to delete old entries, to stop memory usage from becoming too high with old entries
 | 
			
		||||
	toDelete := []string{}
 | 
			
		||||
	b.RLock()
 | 
			
		||||
	for k, v := range b.NicknameMap {
 | 
			
		||||
		if now.Sub(v.lastUpdated) > 10*time.Minute {
 | 
			
		||||
			toDelete = append(toDelete, k)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	b.RUnlock()
 | 
			
		||||
 | 
			
		||||
	b.Lock()
 | 
			
		||||
	for _, v := range toDelete {
 | 
			
		||||
		delete(b.NicknameMap, v)
 | 
			
		||||
	}
 | 
			
		||||
	b.NicknameMap[mxid] = NicknameCacheEntry{
 | 
			
		||||
		displayName: displayName,
 | 
			
		||||
		lastUpdated: now,
 | 
			
		||||
	}
 | 
			
		||||
	b.Unlock()
 | 
			
		||||
 | 
			
		||||
	return displayName
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// handleError converts errors into httpError.
 | 
			
		||||
//nolint:exhaustivestruct
 | 
			
		||||
func handleError(err error) *httpError {
 | 
			
		||||
	var mErr matrix.HTTPError
 | 
			
		||||
	if !errors.As(err, &mErr) {
 | 
			
		||||
		return &httpError{
 | 
			
		||||
			Err: "not a HTTPError",
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var httpErr httpError
 | 
			
		||||
 | 
			
		||||
	if err := json.Unmarshal(mErr.Contents, &httpErr); err != nil {
 | 
			
		||||
		return &httpError{
 | 
			
		||||
			Err: "unmarshal failed",
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &httpErr
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *Bmatrix) containsAttachment(content map[string]interface{}) bool {
 | 
			
		||||
	// Skip empty messages
 | 
			
		||||
	if content["msgtype"] == nil {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Only allow image,video or file msgtypes
 | 
			
		||||
	if !(content["msgtype"].(string) == "m.image" ||
 | 
			
		||||
		content["msgtype"].(string) == "m.video" ||
 | 
			
		||||
		content["msgtype"].(string) == "m.file") {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// getAvatarURL returns the avatar URL of the specified sender.
 | 
			
		||||
func (b *Bmatrix) getAvatarURL(sender string) string {
 | 
			
		||||
	urlPath := b.mc.BuildURL("profile", sender, "avatar_url")
 | 
			
		||||
 | 
			
		||||
	s := struct {
 | 
			
		||||
		AvatarURL string `json:"avatar_url"`
 | 
			
		||||
	}{}
 | 
			
		||||
 | 
			
		||||
	err := b.mc.MakeRequest("GET", urlPath, nil, &s)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		b.Log.Errorf("getAvatarURL failed: %s", err)
 | 
			
		||||
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	url := strings.ReplaceAll(s.AvatarURL, "mxc://", b.GetString("Server")+"/_matrix/media/r0/thumbnail/")
 | 
			
		||||
	if url != "" {
 | 
			
		||||
		url += "?width=37&height=37&method=crop"
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return url
 | 
			
		||||
}
 | 
			
		||||
@@ -2,9 +2,7 @@ package bmatrix
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"html"
 | 
			
		||||
	"mime"
 | 
			
		||||
	"regexp"
 | 
			
		||||
	"strings"
 | 
			
		||||
@@ -22,10 +20,16 @@ var (
 | 
			
		||||
	htmlReplacementTag = regexp.MustCompile("<[^>]*>")
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type NicknameCacheEntry struct {
 | 
			
		||||
	displayName string
 | 
			
		||||
	lastUpdated time.Time
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type Bmatrix struct {
 | 
			
		||||
	mc      *matrix.Client
 | 
			
		||||
	UserID  string
 | 
			
		||||
	RoomMap map[string]string
 | 
			
		||||
	mc          *matrix.Client
 | 
			
		||||
	UserID      string
 | 
			
		||||
	NicknameMap map[string]NicknameCacheEntry
 | 
			
		||||
	RoomMap     map[string]string
 | 
			
		||||
	sync.RWMutex
 | 
			
		||||
	*bridge.Config
 | 
			
		||||
}
 | 
			
		||||
@@ -41,25 +45,29 @@ type matrixUsername struct {
 | 
			
		||||
	formatted string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func newMatrixUsername(username string) *matrixUsername {
 | 
			
		||||
	mUsername := new(matrixUsername)
 | 
			
		||||
// SubTextMessage represents the new content of the message in edit messages.
 | 
			
		||||
type SubTextMessage struct {
 | 
			
		||||
	MsgType string `json:"msgtype"`
 | 
			
		||||
	Body    string `json:"body"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
	// check if we have a </tag>. if we have, we don't escape HTML. #696
 | 
			
		||||
	if htmlTag.MatchString(username) {
 | 
			
		||||
		mUsername.formatted = username
 | 
			
		||||
		// remove the HTML formatting for beautiful push messages #1188
 | 
			
		||||
		mUsername.plain = htmlReplacementTag.ReplaceAllString(username, "")
 | 
			
		||||
	} else {
 | 
			
		||||
		mUsername.formatted = html.EscapeString(username)
 | 
			
		||||
		mUsername.plain = username
 | 
			
		||||
	}
 | 
			
		||||
// MessageRelation explains how the current message relates to a previous message.
 | 
			
		||||
// Notably used for message edits.
 | 
			
		||||
type MessageRelation struct {
 | 
			
		||||
	EventID string `json:"event_id"`
 | 
			
		||||
	Type    string `json:"rel_type"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
	return mUsername
 | 
			
		||||
type EditedMessage struct {
 | 
			
		||||
	NewContent SubTextMessage  `json:"m.new_content"`
 | 
			
		||||
	RelatedTo  MessageRelation `json:"m.relates_to"`
 | 
			
		||||
	matrix.TextMessage
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func New(cfg *bridge.Config) bridge.Bridger {
 | 
			
		||||
	b := &Bmatrix{Config: cfg}
 | 
			
		||||
	b.RoomMap = make(map[string]string)
 | 
			
		||||
	b.NicknameMap = make(map[string]NicknameCacheEntry)
 | 
			
		||||
	return b
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -160,7 +168,32 @@ func (b *Bmatrix) Send(msg config.Message) (string, error) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Edit message if we have an ID
 | 
			
		||||
	// matrix has no editing support
 | 
			
		||||
	if msg.ID != "" {
 | 
			
		||||
		rmsg := EditedMessage{TextMessage: matrix.TextMessage{
 | 
			
		||||
			Body:    username.plain + msg.Text,
 | 
			
		||||
			MsgType: "m.text",
 | 
			
		||||
		}}
 | 
			
		||||
		if b.GetBool("HTMLDisable") {
 | 
			
		||||
			rmsg.TextMessage.FormattedBody = username.formatted + "* " + msg.Text
 | 
			
		||||
		} else {
 | 
			
		||||
			rmsg.Format = "org.matrix.custom.html"
 | 
			
		||||
			rmsg.TextMessage.FormattedBody = username.formatted + "* " + helper.ParseMarkdown(msg.Text)
 | 
			
		||||
		}
 | 
			
		||||
		rmsg.NewContent = SubTextMessage{
 | 
			
		||||
			Body:    rmsg.TextMessage.Body,
 | 
			
		||||
			MsgType: "m.text",
 | 
			
		||||
		}
 | 
			
		||||
		rmsg.RelatedTo = MessageRelation{
 | 
			
		||||
			EventID: msg.ID,
 | 
			
		||||
			Type:    "m.replace",
 | 
			
		||||
		}
 | 
			
		||||
		_, err := b.mc.SendMessageEvent(channel, "m.room.message", rmsg)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return "", err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return msg.ID, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Use notices to send join/leave events
 | 
			
		||||
	if msg.Event == config.EventJoinLeave {
 | 
			
		||||
@@ -192,21 +225,11 @@ func (b *Bmatrix) Send(msg config.Message) (string, error) {
 | 
			
		||||
	return resp.EventID, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *Bmatrix) getRoomID(channel string) string {
 | 
			
		||||
	b.RLock()
 | 
			
		||||
	defer b.RUnlock()
 | 
			
		||||
	for ID, name := range b.RoomMap {
 | 
			
		||||
		if name == channel {
 | 
			
		||||
			return ID
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *Bmatrix) handlematrix() {
 | 
			
		||||
	syncer := b.mc.Syncer.(*matrix.DefaultSyncer)
 | 
			
		||||
	syncer.OnEventType("m.room.redaction", b.handleEvent)
 | 
			
		||||
	syncer.OnEventType("m.room.message", b.handleEvent)
 | 
			
		||||
	syncer.OnEventType("m.room.member", b.handleMemberChange)
 | 
			
		||||
	go func() {
 | 
			
		||||
		for {
 | 
			
		||||
			if err := b.mc.Sync(); err != nil {
 | 
			
		||||
@@ -216,6 +239,45 @@ func (b *Bmatrix) handlematrix() {
 | 
			
		||||
	}()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *Bmatrix) handleEdit(ev *matrix.Event, rmsg config.Message) bool {
 | 
			
		||||
	relationInterface, present := ev.Content["m.relates_to"]
 | 
			
		||||
	newContentInterface, present2 := ev.Content["m.new_content"]
 | 
			
		||||
	if !(present && present2) {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var relation MessageRelation
 | 
			
		||||
	if err := interface2Struct(relationInterface, &relation); err != nil {
 | 
			
		||||
		b.Log.Warnf("Couldn't parse 'm.relates_to' object with value %#v", relationInterface)
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var newContent SubTextMessage
 | 
			
		||||
	if err := interface2Struct(newContentInterface, &newContent); err != nil {
 | 
			
		||||
		b.Log.Warnf("Couldn't parse 'm.new_content' object with value %#v", newContentInterface)
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if relation.Type != "m.replace" {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	rmsg.ID = relation.EventID
 | 
			
		||||
	rmsg.Text = newContent.Body
 | 
			
		||||
	b.Remote <- rmsg
 | 
			
		||||
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *Bmatrix) handleMemberChange(ev *matrix.Event) {
 | 
			
		||||
	// Update the displayname on join messages, according to https://matrix.org/docs/spec/client_server/r0.6.1#events-on-change-of-profile-information
 | 
			
		||||
	if ev.Content["membership"] == "join" {
 | 
			
		||||
		if dn, ok := ev.Content["displayname"].(string); ok {
 | 
			
		||||
			b.cacheDisplayName(ev.Sender, dn)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (b *Bmatrix) handleEvent(ev *matrix.Event) {
 | 
			
		||||
	b.Log.Debugf("== Receiving event: %#v", ev)
 | 
			
		||||
	if ev.Sender != b.UserID {
 | 
			
		||||
@@ -229,7 +291,7 @@ func (b *Bmatrix) handleEvent(ev *matrix.Event) {
 | 
			
		||||
 | 
			
		||||
		// Create our message
 | 
			
		||||
		rmsg := config.Message{
 | 
			
		||||
			Username: ev.Sender[1:],
 | 
			
		||||
			Username: b.getDisplayName(ev.Sender),
 | 
			
		||||
			Channel:  channel,
 | 
			
		||||
			Account:  b.Account,
 | 
			
		||||
			UserID:   ev.Sender,
 | 
			
		||||
@@ -264,6 +326,11 @@ func (b *Bmatrix) handleEvent(ev *matrix.Event) {
 | 
			
		||||
			rmsg.Event = config.EventUserAction
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Is it an edit?
 | 
			
		||||
		if b.handleEdit(ev, rmsg) {
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Do we have attachments
 | 
			
		||||
		if b.containsAttachment(ev.Content) {
 | 
			
		||||
			err := b.handleDownloadFile(&rmsg, ev.Content)
 | 
			
		||||
@@ -409,58 +476,3 @@ func (b *Bmatrix) handleUploadFile(msg *config.Message, channel string, fi *conf
 | 
			
		||||
	}
 | 
			
		||||
	b.Log.Debugf("result: %#v", res)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// skipMessages returns true if this message should not be handled
 | 
			
		||||
func (b *Bmatrix) containsAttachment(content map[string]interface{}) bool {
 | 
			
		||||
	// Skip empty messages
 | 
			
		||||
	if content["msgtype"] == nil {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Only allow image,video or file msgtypes
 | 
			
		||||
	if !(content["msgtype"].(string) == "m.image" ||
 | 
			
		||||
		content["msgtype"].(string) == "m.video" ||
 | 
			
		||||
		content["msgtype"].(string) == "m.file") {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// getAvatarURL returns the avatar URL of the specified sender
 | 
			
		||||
func (b *Bmatrix) getAvatarURL(sender string) string {
 | 
			
		||||
	urlPath := b.mc.BuildURL("profile", sender, "avatar_url")
 | 
			
		||||
 | 
			
		||||
	s := struct {
 | 
			
		||||
		AvatarURL string `json:"avatar_url"`
 | 
			
		||||
	}{}
 | 
			
		||||
 | 
			
		||||
	err := b.mc.MakeRequest("GET", urlPath, nil, &s)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		b.Log.Errorf("getAvatarURL failed: %s", err)
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
	url := strings.ReplaceAll(s.AvatarURL, "mxc://", b.GetString("Server")+"/_matrix/media/r0/thumbnail/")
 | 
			
		||||
	if url != "" {
 | 
			
		||||
		url += "?width=37&height=37&method=crop"
 | 
			
		||||
	}
 | 
			
		||||
	return url
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func handleError(err error) *httpError {
 | 
			
		||||
	mErr, ok := err.(matrix.HTTPError)
 | 
			
		||||
	if !ok {
 | 
			
		||||
		return &httpError{
 | 
			
		||||
			Err: "not a HTTPError",
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var httpErr httpError
 | 
			
		||||
 | 
			
		||||
	if err := json.Unmarshal(mErr.Contents, &httpErr); err != nil {
 | 
			
		||||
		return &httpError{
 | 
			
		||||
			Err: "unmarshal failed",
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return &httpErr
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -113,6 +113,12 @@ func (b *Bwhatsapp) Connect() error {
 | 
			
		||||
		return fmt.Errorf("error on update of contacts: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// see https://github.com/Rhymen/go-whatsapp/issues/137#issuecomment-480316013
 | 
			
		||||
	for len(b.conn.Store.Contacts) == 0 {
 | 
			
		||||
		b.conn.Contacts() // nolint:errcheck
 | 
			
		||||
		<-time.After(1 * time.Second)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// map all the users
 | 
			
		||||
	for id, contact := range b.conn.Store.Contacts {
 | 
			
		||||
		if !isGroupJid(id) && id != "status@broadcast" {
 | 
			
		||||
@@ -192,6 +198,12 @@ func isGroupJid(identifier string) bool {
 | 
			
		||||
func (b *Bwhatsapp) JoinChannel(channel config.ChannelInfo) error {
 | 
			
		||||
	byJid := isGroupJid(channel.Name)
 | 
			
		||||
 | 
			
		||||
	// see https://github.com/Rhymen/go-whatsapp/issues/137#issuecomment-480316013
 | 
			
		||||
	for len(b.conn.Store.Contacts) == 0 {
 | 
			
		||||
		b.conn.Contacts() // nolint:errcheck
 | 
			
		||||
		<-time.After(1 * time.Second)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// verify if we are member of the given group
 | 
			
		||||
	if byJid {
 | 
			
		||||
		// channel.Name specifies static group jID, not the name
 | 
			
		||||
 
 | 
			
		||||
@@ -138,14 +138,14 @@ func (b *Bxmpp) createXMPP() error {
 | 
			
		||||
		User:                         b.GetString("Jid"),
 | 
			
		||||
		Password:                     b.GetString("Password"),
 | 
			
		||||
		NoTLS:                        true,
 | 
			
		||||
		StartTLS:                     true,
 | 
			
		||||
		StartTLS:                     !b.GetBool("NoTLS"),
 | 
			
		||||
		TLSConfig:                    tc,
 | 
			
		||||
		Debug:                        b.GetBool("debug"),
 | 
			
		||||
		Session:                      true,
 | 
			
		||||
		Status:                       "",
 | 
			
		||||
		StatusMessage:                "",
 | 
			
		||||
		Resource:                     "",
 | 
			
		||||
		InsecureAllowUnencryptedAuth: false,
 | 
			
		||||
		InsecureAllowUnencryptedAuth: b.GetBool("NoTLS"),
 | 
			
		||||
	}
 | 
			
		||||
	var err error
 | 
			
		||||
	b.xc, err = options.NewClient()
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										25
									
								
								changelog.md
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								changelog.md
									
									
									
									
									
								
							@@ -1,3 +1,28 @@
 | 
			
		||||
# v1.20.0
 | 
			
		||||
 | 
			
		||||
## Breaking
 | 
			
		||||
 | 
			
		||||
- matrix: Send the display name instead of the user name (matrix) (#1282)  
 | 
			
		||||
  Matrix now sends the displayname if set instead of the username. If you want to keep the username, add  `UseUsername=true` to your matrix config. <https://github.com/42wim/matterbridge/wiki/Settings#useusername-1>
 | 
			
		||||
- discord: Disable webhook editing (discord) (#1296)  
 | 
			
		||||
  Because of issues with ratelimiting of webhook editing, this feature is now disabled. If you have multiple discord channels you bridge, you'll need to add a `webhookURL` to the `[gateway.inout.options]`. See <https://github.com/42wim/matterbridge/blob/master/matterbridge.toml.sample#L1864-L1870> for an example.
 | 
			
		||||
 | 
			
		||||
## New features
 | 
			
		||||
 | 
			
		||||
- general: Allow tengo to drop messages using msgDrop (#1272)
 | 
			
		||||
- general: Update libraries (whatsapp,markdown,mattermost,ssh-chat)
 | 
			
		||||
- irc: Add PingDelay option (irc) (#1269)
 | 
			
		||||
- matrix: Allow message edits on matrix (#1286)
 | 
			
		||||
- xmpp: add NoTLS option to allow plaintext XMPP connections (#1288)
 | 
			
		||||
 | 
			
		||||
## Enhancements
 | 
			
		||||
 | 
			
		||||
- discord: Edit messages via webhook (1287)
 | 
			
		||||
- general: Add extra debug to log time spent sending a message per bridge (#1299)
 | 
			
		||||
 | 
			
		||||
This release couldn't exist without the following contributors:
 | 
			
		||||
@nightmared, @zhoreeq
 | 
			
		||||
 | 
			
		||||
# v1.19.0
 | 
			
		||||
 | 
			
		||||
## New features
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
package gateway
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io/ioutil"
 | 
			
		||||
	"os"
 | 
			
		||||
	"regexp"
 | 
			
		||||
@@ -363,10 +364,23 @@ func (gw *Gateway) modifyAvatar(msg *config.Message, dest *bridge.Bridge) string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (gw *Gateway) modifyMessage(msg *config.Message) {
 | 
			
		||||
	if err := modifyMessageTengo(gw.BridgeValues().General.TengoModifyMessage, msg); err != nil {
 | 
			
		||||
	if gw.BridgeValues().General.TengoModifyMessage != "" {
 | 
			
		||||
		gw.logger.Warnf("General TengoModifyMessage=%s is deprecated and will be removed in v1.20.0, please move to Tengo InMessage=%s", gw.BridgeValues().General.TengoModifyMessage, gw.BridgeValues().General.TengoModifyMessage)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := modifyInMessageTengo(gw.BridgeValues().General.TengoModifyMessage, msg); err != nil {
 | 
			
		||||
		gw.logger.Errorf("TengoModifyMessage failed: %s", err)
 | 
			
		||||
	}
 | 
			
		||||
	if err := modifyMessageTengo(gw.BridgeValues().Tengo.Message, msg); err != nil {
 | 
			
		||||
 | 
			
		||||
	inMessage := gw.BridgeValues().Tengo.InMessage
 | 
			
		||||
	if inMessage == "" {
 | 
			
		||||
		inMessage = gw.BridgeValues().Tengo.Message
 | 
			
		||||
		if inMessage != "" {
 | 
			
		||||
			gw.logger.Warnf("Tengo Message=%s is deprecated and will be removed in v1.20.0, please move to Tengo InMessage=%s", inMessage, inMessage)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := modifyInMessageTengo(inMessage, msg); err != nil {
 | 
			
		||||
		gw.logger.Errorf("Tengo.Message failed: %s", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -416,9 +430,15 @@ func (gw *Gateway) SendMessage(
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Only send irc notices to irc
 | 
			
		||||
	if msg.Event == config.EventNoticeIRC && dest.Protocol != "irc" {
 | 
			
		||||
		return "", nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Too noisy to log like other events
 | 
			
		||||
	debugSendMessage := ""
 | 
			
		||||
	if msg.Event != config.EventUserTyping {
 | 
			
		||||
		gw.logger.Debugf("=> Sending %#v from %s (%s) to %s (%s)", msg, msg.Account, rmsg.Channel, dest.Account, channel.Name)
 | 
			
		||||
		debugSendMessage = fmt.Sprintf("=> Sending %#v from %s (%s) to %s (%s)", msg, msg.Account, rmsg.Channel, dest.Account, channel.Name)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	msg.Channel = channel.Name
 | 
			
		||||
@@ -443,17 +463,29 @@ func (gw *Gateway) SendMessage(
 | 
			
		||||
		msg.ParentID = "msg-parent-not-found"
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err := gw.modifySendMessageTengo(rmsg, &msg, dest)
 | 
			
		||||
	drop, err := gw.modifyOutMessageTengo(rmsg, &msg, dest)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		gw.logger.Errorf("modifySendMessageTengo: %s", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if drop {
 | 
			
		||||
		gw.logger.Debugf("=> Tengo dropping %#v from %s (%s) to %s (%s)", msg, msg.Account, rmsg.Channel, dest.Account, channel.Name)
 | 
			
		||||
		return "", nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if debugSendMessage != "" {
 | 
			
		||||
		gw.logger.Debug(debugSendMessage)
 | 
			
		||||
	}
 | 
			
		||||
	// if we are using mattermost plugin account, send messages to MattermostPlugin channel
 | 
			
		||||
	// that can be picked up by the mattermost matterbridge plugin
 | 
			
		||||
	if dest.Account == "mattermost.plugin" {
 | 
			
		||||
		gw.Router.MattermostPlugin <- msg
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	defer func(t time.Time) {
 | 
			
		||||
		gw.logger.Debugf("=> Send from %s (%s) to %s (%s) took %s", msg.Account, rmsg.Channel, dest.Account, channel.Name, time.Since(t))
 | 
			
		||||
	}(time.Now())
 | 
			
		||||
 | 
			
		||||
	mID, err := dest.Send(msg)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return mID, err
 | 
			
		||||
@@ -505,7 +537,7 @@ func getProtocol(msg *config.Message) string {
 | 
			
		||||
	return p[0]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func modifyMessageTengo(filename string, msg *config.Message) error {
 | 
			
		||||
func modifyInMessageTengo(filename string, msg *config.Message) error {
 | 
			
		||||
	if filename == "" {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
@@ -564,22 +596,28 @@ func (gw *Gateway) modifyUsernameTengo(msg *config.Message, br *bridge.Bridge) (
 | 
			
		||||
	return c.Get("result").String(), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (gw *Gateway) modifySendMessageTengo(origmsg *config.Message, msg *config.Message, br *bridge.Bridge) error {
 | 
			
		||||
func (gw *Gateway) modifyOutMessageTengo(origmsg *config.Message, msg *config.Message, br *bridge.Bridge) (bool, error) {
 | 
			
		||||
	filename := gw.BridgeValues().Tengo.OutMessage
 | 
			
		||||
	var res []byte
 | 
			
		||||
	var err error
 | 
			
		||||
	var (
 | 
			
		||||
		res  []byte
 | 
			
		||||
		err  error
 | 
			
		||||
		drop bool
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	if filename == "" {
 | 
			
		||||
		res, err = internal.Asset("tengo/outmessage.tengo")
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
			return drop, err
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		res, err = ioutil.ReadFile(filename)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
			return drop, err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	s := tengo.NewScript(res)
 | 
			
		||||
 | 
			
		||||
	s.SetImports(stdlib.GetModuleMap(stdlib.AllModuleNames()...))
 | 
			
		||||
	_ = s.Add("inAccount", origmsg.Account)
 | 
			
		||||
	_ = s.Add("inProtocol", origmsg.Protocol)
 | 
			
		||||
@@ -593,14 +631,19 @@ func (gw *Gateway) modifySendMessageTengo(origmsg *config.Message, msg *config.M
 | 
			
		||||
	_ = s.Add("outEvent", msg.Event)
 | 
			
		||||
	_ = s.Add("msgText", msg.Text)
 | 
			
		||||
	_ = s.Add("msgUsername", msg.Username)
 | 
			
		||||
	_ = s.Add("msgDrop", drop)
 | 
			
		||||
	c, err := s.Compile()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
		return drop, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := c.Run(); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
		return drop, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	drop = c.Get("msgDrop").Bool()
 | 
			
		||||
	msg.Text = c.Get("msgText").String()
 | 
			
		||||
	msg.Username = c.Get("msgUsername").String()
 | 
			
		||||
	return nil
 | 
			
		||||
 | 
			
		||||
	return drop, nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -533,7 +533,7 @@ func (s *ignoreTestSuite) TestIgnoreNicks() {
 | 
			
		||||
func BenchmarkTengo(b *testing.B) {
 | 
			
		||||
	msg := &config.Message{Username: "user", Text: "blah testing", Account: "protocol.account", Channel: "mychannel"}
 | 
			
		||||
	for n := 0; n < b.N; n++ {
 | 
			
		||||
		err := modifyMessageTengo("bench.tengo", msg)
 | 
			
		||||
		err := modifyInMessageTengo("bench.tengo", msg)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										20
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								go.mod
									
									
									
									
									
								
							@@ -5,13 +5,13 @@ require (
 | 
			
		||||
	github.com/Baozisoftware/qrcode-terminal-go v0.0.0-20170407111555-c0650d8dff0f
 | 
			
		||||
	github.com/Jeffail/gabs v1.1.1 // indirect
 | 
			
		||||
	github.com/Philipp15b/go-steam v1.0.1-0.20200727090957-6ae9b3c0a560
 | 
			
		||||
	github.com/Rhymen/go-whatsapp v0.1.1-0.20201007125822-005103751b7a
 | 
			
		||||
	github.com/Rhymen/go-whatsapp v0.1.2-0.20201122130733-6e5488ac98df
 | 
			
		||||
	github.com/d5/tengo/v2 v2.6.2
 | 
			
		||||
	github.com/davecgh/go-spew v1.1.1
 | 
			
		||||
	github.com/fsnotify/fsnotify v1.4.9
 | 
			
		||||
	github.com/go-telegram-bot-api/telegram-bot-api v1.0.1-0.20200524105306-7434b0456e81
 | 
			
		||||
	github.com/gomarkdown/markdown v0.0.0-20200824053859-8c8b3816f167
 | 
			
		||||
	github.com/google/gops v0.3.11
 | 
			
		||||
	github.com/gomarkdown/markdown v0.0.0-20201113031856-722100d81a8e
 | 
			
		||||
	github.com/google/gops v0.3.13
 | 
			
		||||
	github.com/gopackage/ddp v0.0.0-20170117053602-652027933df4 // indirect
 | 
			
		||||
	github.com/gorilla/schema v1.2.0
 | 
			
		||||
	github.com/gorilla/websocket v1.4.2
 | 
			
		||||
@@ -22,15 +22,15 @@ require (
 | 
			
		||||
	github.com/lrstanley/girc v0.0.0-20190801035559-4fc93959e1a7
 | 
			
		||||
	github.com/matrix-org/gomatrix v0.0.0-20200827122206-7dd5e2a05bcd
 | 
			
		||||
	github.com/matterbridge/Rocket.Chat.Go.SDK v0.0.0-20200411204219-d5c18ce75048
 | 
			
		||||
	github.com/matterbridge/discordgo v0.22.0
 | 
			
		||||
	github.com/matterbridge/discordgo v0.22.1
 | 
			
		||||
	github.com/matterbridge/emoji v2.1.1-0.20191117213217-af507f6b02db+incompatible
 | 
			
		||||
	github.com/matterbridge/go-xmpp v0.0.0-20200418225040-c8a3a57b4050
 | 
			
		||||
	github.com/matterbridge/gozulipbot v0.0.0-20200820220548-be5824faa913
 | 
			
		||||
	github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba
 | 
			
		||||
	github.com/mattermost/mattermost-server/v5 v5.28.1
 | 
			
		||||
	github.com/mattn/godown v0.0.0-20200217152941-afc959f6a561
 | 
			
		||||
	github.com/mattermost/mattermost-server/v5 v5.29.0
 | 
			
		||||
	github.com/mattn/godown v0.0.0-20201027140031-2c7783b24de7
 | 
			
		||||
	github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
 | 
			
		||||
	github.com/missdeer/golib v1.0.3
 | 
			
		||||
	github.com/missdeer/golib v1.0.4
 | 
			
		||||
	github.com/mreiferson/go-httpclient v0.0.0-20160630210159-31f0106b4474 // indirect
 | 
			
		||||
	github.com/mrexodia/wray v0.0.0-20160318003008-78a2c1f284ff // indirect
 | 
			
		||||
	github.com/nelsonken/gomf v0.0.0-20180504123937-a9dd2f9deae9
 | 
			
		||||
@@ -38,7 +38,7 @@ require (
 | 
			
		||||
	github.com/rs/xid v1.2.1
 | 
			
		||||
	github.com/russross/blackfriday v1.5.2
 | 
			
		||||
	github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca
 | 
			
		||||
	github.com/shazow/ssh-chat v1.8.3-0.20200308224626-80ddf1f43a98
 | 
			
		||||
	github.com/shazow/ssh-chat v1.10.1
 | 
			
		||||
	github.com/sirupsen/logrus v1.7.0
 | 
			
		||||
	github.com/slack-go/slack v0.7.2
 | 
			
		||||
	github.com/spf13/viper v1.7.1
 | 
			
		||||
@@ -49,10 +49,10 @@ require (
 | 
			
		||||
	github.com/yaegashi/msgraph.go v0.1.4
 | 
			
		||||
	github.com/zfjagann/golang-ring v0.0.0-20190304061218-d34796e0a6c2
 | 
			
		||||
	golang.org/x/image v0.0.0-20200927104501-e162460cd6b5
 | 
			
		||||
	golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43
 | 
			
		||||
	golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58
 | 
			
		||||
	gomod.garykim.dev/nc-talk v0.1.5
 | 
			
		||||
	gopkg.in/olahol/melody.v1 v1.0.0-20170518105555-d52139073376
 | 
			
		||||
	layeh.com/gumble v0.0.0-20200818122324-146f9205029b
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
go 1.13
 | 
			
		||||
go 1.15
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										51
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								go.sum
									
									
									
									
									
								
							@@ -71,8 +71,8 @@ github.com/PaulARoy/azurestoragecache v0.0.0-20170906084534-3c249a3ba788/go.mod
 | 
			
		||||
github.com/Philipp15b/go-steam v1.0.1-0.20200727090957-6ae9b3c0a560 h1:ItnC9PEEMESzTbFayxrhKBbuFQOXDBI8yy7NudTcEWs=
 | 
			
		||||
github.com/Philipp15b/go-steam v1.0.1-0.20200727090957-6ae9b3c0a560/go.mod h1:o38AwUFFS4gzbjSoyIgrZ1h9UeDrKwcci1Pj6baifvI=
 | 
			
		||||
github.com/Rhymen/go-whatsapp v0.0.0/go.mod h1:rdQr95g2C1xcOfM7QGOhza58HeI3I+tZ/bbluv7VazA=
 | 
			
		||||
github.com/Rhymen/go-whatsapp v0.1.1-0.20201007125822-005103751b7a h1:LW+rX0NY6LzMPa2hJcgmQlfiFJUihzOMAaIoCq+P3xc=
 | 
			
		||||
github.com/Rhymen/go-whatsapp v0.1.1-0.20201007125822-005103751b7a/go.mod h1:o7jjkvKnigfu432dMbQ/w4PH0Yp5u4Y6ysCNjUlcYCk=
 | 
			
		||||
github.com/Rhymen/go-whatsapp v0.1.2-0.20201122130733-6e5488ac98df h1:w1TSfL7OvTaHlYQlF8EGqnWKVn0It6Gyn7bXR0Mz7Qw=
 | 
			
		||||
github.com/Rhymen/go-whatsapp v0.1.2-0.20201122130733-6e5488ac98df/go.mod h1:o7jjkvKnigfu432dMbQ/w4PH0Yp5u4Y6ysCNjUlcYCk=
 | 
			
		||||
github.com/Rhymen/go-whatsapp/examples/echo v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:zgCiQtBtZ4P4gFWvwl9aashsdwOcbb/EHOGRmSzM8ME=
 | 
			
		||||
github.com/Rhymen/go-whatsapp/examples/restoreSession v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:5sCUSpG616ZoSJhlt9iBNI/KXBqrVLcNUJqg7J9+8pU=
 | 
			
		||||
github.com/Rhymen/go-whatsapp/examples/sendImage v0.0.0-20190325075644-cc2581bbf24d/go.mod h1:RdiyhanVEGXTam+mZ3k6Y3VDCCvXYCwReOoxGozqhHw=
 | 
			
		||||
@@ -92,6 +92,7 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
 | 
			
		||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
 | 
			
		||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
 | 
			
		||||
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
 | 
			
		||||
github.com/alexcesaro/log v0.0.0-20150915221235-61e686294e58 h1:MkpmYfld/S8kXqTYI68DfL8/hHXjHogL120Dy00TIxc=
 | 
			
		||||
github.com/alexcesaro/log v0.0.0-20150915221235-61e686294e58/go.mod h1:YNfsMyWSs+h+PaYkxGeMVmVCX75Zj/pqdjbu12ciCYE=
 | 
			
		||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
 | 
			
		||||
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
 | 
			
		||||
@@ -291,8 +292,8 @@ github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0
 | 
			
		||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
 | 
			
		||||
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
 | 
			
		||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
 | 
			
		||||
github.com/gomarkdown/markdown v0.0.0-20200824053859-8c8b3816f167 h1:LP/6EfrZ/LyCc+SXvANDrIJ4sP9u2NAtqyv6QknetNQ=
 | 
			
		||||
github.com/gomarkdown/markdown v0.0.0-20200824053859-8c8b3816f167/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU=
 | 
			
		||||
github.com/gomarkdown/markdown v0.0.0-20201113031856-722100d81a8e h1:/Y3B7hM9H3TOWPhe8eWGBGS4r09pjvS5Z0uoPADyjmU=
 | 
			
		||||
github.com/gomarkdown/markdown v0.0.0-20201113031856-722100d81a8e/go.mod h1:aii0r/K0ZnHv7G0KF7xy1v0A7s2Ljrb5byB7MO5p6TU=
 | 
			
		||||
github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
 | 
			
		||||
github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4=
 | 
			
		||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
 | 
			
		||||
@@ -309,8 +310,8 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
 | 
			
		||||
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
 | 
			
		||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
 | 
			
		||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
 | 
			
		||||
github.com/google/gops v0.3.11 h1:TJThjZOyavVoT7C+tkjLMzcUGud9WiWHKPLRCcd2Sro=
 | 
			
		||||
github.com/google/gops v0.3.11/go.mod h1:38bMPVKFh+1X106CPpbLAWtZIR1+xwgzT9gew0kn6w4=
 | 
			
		||||
github.com/google/gops v0.3.13 h1:8lgvDd3tXe4UxVbmPPTGE0ToIpbh3hgXkt4EVZ8Y/hU=
 | 
			
		||||
github.com/google/gops v0.3.13/go.mod h1:38bMPVKFh+1X106CPpbLAWtZIR1+xwgzT9gew0kn6w4=
 | 
			
		||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
 | 
			
		||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
 | 
			
		||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
 | 
			
		||||
@@ -403,7 +404,7 @@ github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOn
 | 
			
		||||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
 | 
			
		||||
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
 | 
			
		||||
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
 | 
			
		||||
github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs=
 | 
			
		||||
github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs=
 | 
			
		||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
 | 
			
		||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
 | 
			
		||||
github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
 | 
			
		||||
@@ -496,8 +497,8 @@ github.com/matrix-org/gomatrix v0.0.0-20200827122206-7dd5e2a05bcd h1:xVrqJK3xHRE
 | 
			
		||||
github.com/matrix-org/gomatrix v0.0.0-20200827122206-7dd5e2a05bcd/go.mod h1:/gBX06Kw0exX1HrwmoBibFA98yBk/jxKpGVeyQbff+s=
 | 
			
		||||
github.com/matterbridge/Rocket.Chat.Go.SDK v0.0.0-20200411204219-d5c18ce75048 h1:B9HaistmV+MD8/33BXmZe1zPIn+RImAFVXNNSOrwU2E=
 | 
			
		||||
github.com/matterbridge/Rocket.Chat.Go.SDK v0.0.0-20200411204219-d5c18ce75048/go.mod h1:c6MxwqHD+0HvtAJjsHMIdPCiAwGiQwPRPTp69ACMg8A=
 | 
			
		||||
github.com/matterbridge/discordgo v0.22.0 h1:6EnYacrU28X5Bc6BQDOqR6O8/b+588RKqoQJPUXEJAw=
 | 
			
		||||
github.com/matterbridge/discordgo v0.22.0/go.mod h1:411nZYv0UMMrtppR5glXop1foboJiFAowy+42U+Ahvw=
 | 
			
		||||
github.com/matterbridge/discordgo v0.22.1 h1:Wh2NXfvF4egJDxX7jEvtgxJgT/ZOqD/5tfcIsNnHJ9o=
 | 
			
		||||
github.com/matterbridge/discordgo v0.22.1/go.mod h1:411nZYv0UMMrtppR5glXop1foboJiFAowy+42U+Ahvw=
 | 
			
		||||
github.com/matterbridge/emoji v2.1.1-0.20191117213217-af507f6b02db+incompatible h1:oaOqwbg5HxHRxvAbd84ks0Okwoc1ISyUZ87EiVJFhGI=
 | 
			
		||||
github.com/matterbridge/emoji v2.1.1-0.20191117213217-af507f6b02db+incompatible/go.mod h1:igE6rUAn3jai2wCdsjFHfhUoekjrFthoEjFObKKwSb4=
 | 
			
		||||
github.com/matterbridge/go-xmpp v0.0.0-20200418225040-c8a3a57b4050 h1:kWkP1lXpkvtoNL08jkP3XQH/zvDOEXJpdCJd/DlIvMw=
 | 
			
		||||
@@ -514,8 +515,8 @@ github.com/mattermost/ldap v0.0.0-20191128190019-9f62ba4b8d4d h1:2DV7VIlEv6J5R5o
 | 
			
		||||
github.com/mattermost/ldap v0.0.0-20191128190019-9f62ba4b8d4d/go.mod h1:HLbgMEI5K131jpxGazJ97AxfPDt31osq36YS1oxFQPQ=
 | 
			
		||||
github.com/mattermost/logr v1.0.13 h1:6F/fM3csvH6Oy5sUpJuW7YyZSzZZAhJm5VcgKMxA2P8=
 | 
			
		||||
github.com/mattermost/logr v1.0.13/go.mod h1:Mt4DPu1NXMe6JxPdwCC0XBoxXmN9eXOIRPoZarU2PXs=
 | 
			
		||||
github.com/mattermost/mattermost-server/v5 v5.28.1 h1:zCPvSlEYCs0REHzGxaf06Dha4UnFlhBVutH3Fthw7J0=
 | 
			
		||||
github.com/mattermost/mattermost-server/v5 v5.28.1/go.mod h1:9FfgZY9Ywx64bzPBYo4mmR05ApyOxO+tr43eDhpWups=
 | 
			
		||||
github.com/mattermost/mattermost-server/v5 v5.29.0 h1:v+qGNpMkgYRJY1qn4Rx2u1W7dbkmes47NnDZLSTIRGU=
 | 
			
		||||
github.com/mattermost/mattermost-server/v5 v5.29.0/go.mod h1:9FfgZY9Ywx64bzPBYo4mmR05ApyOxO+tr43eDhpWups=
 | 
			
		||||
github.com/mattermost/rsc v0.0.0-20160330161541-bbaefb05eaa0/go.mod h1:nV5bfVpT//+B1RPD2JvRnxbkLmJEYXmRaaVl15fsXjs=
 | 
			
		||||
github.com/mattermost/viper v1.0.4/go.mod h1:uc5hKG9lv4/KRwPOt2c1omOyirS/UnuA2TytiZQSFHM=
 | 
			
		||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
 | 
			
		||||
@@ -542,8 +543,8 @@ github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/Qd
 | 
			
		||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
 | 
			
		||||
github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
 | 
			
		||||
github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
 | 
			
		||||
github.com/mattn/godown v0.0.0-20200217152941-afc959f6a561 h1:0YGo77enc6tJpXQxUeQWs9bPIQPTH1lbOmc5tgRuq4o=
 | 
			
		||||
github.com/mattn/godown v0.0.0-20200217152941-afc959f6a561/go.mod h1:/ivCKurgV/bx6yqtP/Jtc2Xmrv3beCYBvlfAUl4X5g4=
 | 
			
		||||
github.com/mattn/godown v0.0.0-20201027140031-2c7783b24de7 h1:UeXqxG2wTENf2BataGYSoX3jUrJ5PI0ceUzdL1L+BPI=
 | 
			
		||||
github.com/mattn/godown v0.0.0-20201027140031-2c7783b24de7/go.mod h1:/ivCKurgV/bx6yqtP/Jtc2Xmrv3beCYBvlfAUl4X5g4=
 | 
			
		||||
github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
 | 
			
		||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
 | 
			
		||||
github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go.mod h1:dSsfyI2zABAdhcbvkXqgxOxrCsbYeHCPgrZkku60dSg=
 | 
			
		||||
@@ -558,8 +559,8 @@ github.com/miekg/dns v1.1.31/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7
 | 
			
		||||
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
 | 
			
		||||
github.com/minio/minio-go/v7 v7.0.4/go.mod h1:CSt2ETZNs+bIIhWTse0mcZKZWMGrFU7Er7RR0TmkDYk=
 | 
			
		||||
github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
 | 
			
		||||
github.com/missdeer/golib v1.0.3 h1:+kz/tn1lXlPS8i+gjHHVAZC8YcgrmfiMTqELyvOwI4g=
 | 
			
		||||
github.com/missdeer/golib v1.0.3/go.mod h1:Cys1ITPPZxIk2eTcQcKT3jDsBdhICAfrrw+ki/eRXxA=
 | 
			
		||||
github.com/missdeer/golib v1.0.4 h1:tM7MJIPffXSmwFCTOCMjL5C7JsT5SQ+OmZwzssZQOa8=
 | 
			
		||||
github.com/missdeer/golib v1.0.4/go.mod h1:mPN/UcszFq0GxKfQsZI3aFOiRjnzXCBZ392od3guGEY=
 | 
			
		||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
 | 
			
		||||
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
 | 
			
		||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
 | 
			
		||||
@@ -732,10 +733,10 @@ github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZ
 | 
			
		||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
 | 
			
		||||
github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3/go.mod h1:9/Rh6yILuLysoQnZ2oNooD2g7aBnvM7r/fNVxRNWfBc=
 | 
			
		||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
 | 
			
		||||
github.com/shazow/rateio v0.0.0-20150116013248-e8e00881e5c1 h1:Lx3BlDGFElJt4u/zKc9A3BuGYbQAGlEFyPuUA3jeMD0=
 | 
			
		||||
github.com/shazow/rateio v0.0.0-20150116013248-e8e00881e5c1/go.mod h1:vt2jWY/3Qw1bIzle5thrJWucsLuuX9iUNnp20CqCciI=
 | 
			
		||||
github.com/shazow/ssh-chat v1.8.3-0.20200308224626-80ddf1f43a98 h1:sN07ff+PSRsUNhpSod4uGKAQ+Nc0FXsBPG9FmYMNg4w=
 | 
			
		||||
github.com/shazow/ssh-chat v1.8.3-0.20200308224626-80ddf1f43a98/go.mod h1:xkTgfD+WP+KR4HuG76oal25BBEeu5kJyi2EOsgiu/4Q=
 | 
			
		||||
github.com/shazow/rateio v0.0.0-20200113175441-4461efc8bdc4 h1:zwQ1HBo5FYwn1ksMd19qBCKO8JAWE9wmHivEpkw/DvE=
 | 
			
		||||
github.com/shazow/rateio v0.0.0-20200113175441-4461efc8bdc4/go.mod h1:vt2jWY/3Qw1bIzle5thrJWucsLuuX9iUNnp20CqCciI=
 | 
			
		||||
github.com/shazow/ssh-chat v1.10.1 h1:ePS+ngEYqm+yUuXegDPutysqLV2WoI22XDOeRgI6CE0=
 | 
			
		||||
github.com/shazow/ssh-chat v1.10.1/go.mod h1:0+7szsKylcre0vljkVnbuI6q7Odtc+QCDHxa+fFNV54=
 | 
			
		||||
github.com/shirou/gopsutil v2.20.4+incompatible h1:cMT4rxS55zx9NVUnCkrmXCsEB/RNfG9SwHY9evtX8Ng=
 | 
			
		||||
github.com/shirou/gopsutil v2.20.4+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
 | 
			
		||||
github.com/shurcooL/component v0.0.0-20170202220835-f88ec8f54cc4/go.mod h1:XhFIlyj5a1fBNx5aJTbKoIq0mNaPvOagO+HjB3EtxrY=
 | 
			
		||||
@@ -936,7 +937,6 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf
 | 
			
		||||
golang.org/x/crypto v0.0.0-20190131182504-b8fe1690c613/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20190320223903-b7391e95e576/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
 | 
			
		||||
@@ -949,6 +949,8 @@ golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPh
 | 
			
		||||
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E=
 | 
			
		||||
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
 | 
			
		||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 | 
			
		||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 | 
			
		||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
 | 
			
		||||
@@ -1046,8 +1048,8 @@ golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4Iltr
 | 
			
		||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
 | 
			
		||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw=
 | 
			
		||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
 | 
			
		||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 h1:ld7aEMNHoBnnDAX15v1T6z31v8HwR2A9FYOuAhWqkwc=
 | 
			
		||||
golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
 | 
			
		||||
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 h1:Mj83v+wSRNEar42a/MQgxk9X42TdEmrOl9i+y8WbxLo=
 | 
			
		||||
golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
 | 
			
		||||
golang.org/x/perf v0.0.0-20180704124530-6e6d33e29852/go.mod h1:JLpeXjPJfIyPr5TlbXLkXWLhP8nz10XfvxElABhCtcw=
 | 
			
		||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 | 
			
		||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 | 
			
		||||
@@ -1073,7 +1075,6 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
 | 
			
		||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
			
		||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
			
		||||
golang.org/x/sys v0.0.0-20190316082340-a2f829d7f35f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
			
		||||
golang.org/x/sys v0.0.0-20190321052220-f7bb7a8bee54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
			
		||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
			
		||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
			
		||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
			
		||||
@@ -1117,6 +1118,8 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w
 | 
			
		||||
golang.org/x/sys v0.0.0-20200817155316-9781c653f443/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
			
		||||
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6 h1:DvY3Zkh7KabQE/kfzMvYvKirSiguP9Q/veMtkYyf0o8=
 | 
			
		||||
golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
			
		||||
golang.org/x/sys v0.0.0-20201110211018-35f3e6cf4a65 h1:Qo9oJ566/Sq7N4hrGftVXs8GI2CXBCuOd4S2wHE/e0M=
 | 
			
		||||
golang.org/x/sys v0.0.0-20201110211018-35f3e6cf4a65/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 | 
			
		||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 | 
			
		||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 | 
			
		||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 | 
			
		||||
@@ -1124,6 +1127,8 @@ golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
 | 
			
		||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
 | 
			
		||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
 | 
			
		||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 | 
			
		||||
golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc=
 | 
			
		||||
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 | 
			
		||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 | 
			
		||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 | 
			
		||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,7 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	version = "1.19.0"
 | 
			
		||||
	version = "1.20.1-dev"
 | 
			
		||||
	githash string
 | 
			
		||||
 | 
			
		||||
	flagConfig  = flag.String("conf", "matterbridge.toml", "config file")
 | 
			
		||||
 
 | 
			
		||||
@@ -103,6 +103,12 @@ ColorNicks=false
 | 
			
		||||
#OPTIONAL (default empty)
 | 
			
		||||
RunCommands=["PRIVMSG user hello","PRIVMSG chanserv something"]
 | 
			
		||||
 | 
			
		||||
#PingDelay specifies how long to wait to send a ping to the irc server.
 | 
			
		||||
#You can use s for second, m for minute
 | 
			
		||||
#String
 | 
			
		||||
#OPTIONAL (default 1m)
 | 
			
		||||
PingDelay="1m"
 | 
			
		||||
 | 
			
		||||
#StripMarkdown strips markdown from messages
 | 
			
		||||
#OPTIONAL (default false)
 | 
			
		||||
StripMarkdown=false
 | 
			
		||||
@@ -221,6 +227,10 @@ Nick="xmppbot"
 | 
			
		||||
#OPTIONAL (default false)
 | 
			
		||||
SkipTLSVerify=true
 | 
			
		||||
 | 
			
		||||
#Enable to use plaintext connection to your XMPP server.
 | 
			
		||||
#OPTIONAL (default false)
 | 
			
		||||
NoTLS=true
 | 
			
		||||
 | 
			
		||||
## RELOADABLE SETTINGS
 | 
			
		||||
## Settings below can be reloaded by editing the file
 | 
			
		||||
 | 
			
		||||
@@ -1221,6 +1231,9 @@ HTMLDisable=false
 | 
			
		||||
## RELOADABLE SETTINGS
 | 
			
		||||
## Settings below can be reloaded by editing the file
 | 
			
		||||
 | 
			
		||||
# UseUserName shows the username instead of the server nickname
 | 
			
		||||
UseUserName=false
 | 
			
		||||
 | 
			
		||||
#Whether to prefix messages from other bridges to matrix with the sender's nick.
 | 
			
		||||
#Useful if username overrides for incoming webhooks isn't enabled on the
 | 
			
		||||
#matrix server. If you set PrefixMessagesWithNick to true, each message
 | 
			
		||||
@@ -1720,7 +1733,9 @@ InMessage="example.tengo"
 | 
			
		||||
#outAccount, outProtocol, outChannel, outGateway, outEvent
 | 
			
		||||
#
 | 
			
		||||
#read-write:
 | 
			
		||||
#msgText, msgUsername
 | 
			
		||||
#msgText, msgUsername, msgDrop
 | 
			
		||||
#
 | 
			
		||||
#msgDrop is a bool which is default false, when set true this message will be dropped
 | 
			
		||||
#
 | 
			
		||||
#The script is reloaded on every message, so you can modify the script on the fly.
 | 
			
		||||
#
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										82
									
								
								vendor/github.com/Rhymen/go-whatsapp/conn.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										82
									
								
								vendor/github.com/Rhymen/go-whatsapp/conn.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -116,31 +116,59 @@ Creates a new connection with a given timeout. The websocket connection to the W
 | 
			
		||||
The goroutine for handling incoming messages is started
 | 
			
		||||
*/
 | 
			
		||||
func NewConn(timeout time.Duration) (*Conn, error) {
 | 
			
		||||
	wac := &Conn{
 | 
			
		||||
		handler:    make([]Handler, 0),
 | 
			
		||||
		msgCount:   0,
 | 
			
		||||
		msgTimeout: timeout,
 | 
			
		||||
		Store:      newStore(),
 | 
			
		||||
 | 
			
		||||
		longClientName:  "github.com/rhymen/go-whatsapp",
 | 
			
		||||
		shortClientName: "go-whatsapp",
 | 
			
		||||
		clientVersion:   "0.1.0",
 | 
			
		||||
	}
 | 
			
		||||
	return wac, wac.connect()
 | 
			
		||||
	return NewConnWithOptions(&Options{
 | 
			
		||||
		Timeout: timeout,
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewConnWithProxy Create a new connect with a given timeout and a http proxy.
 | 
			
		||||
func NewConnWithProxy(timeout time.Duration, proxy func(*http.Request) (*url.URL, error)) (*Conn, error) {
 | 
			
		||||
	return NewConnWithOptions(&Options{
 | 
			
		||||
		Timeout: timeout,
 | 
			
		||||
		Proxy: proxy,
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewConnWithOptions Create a new connect with a given options.
 | 
			
		||||
type Options struct {
 | 
			
		||||
	Proxy            func(*http.Request) (*url.URL, error)
 | 
			
		||||
	Timeout          time.Duration
 | 
			
		||||
	Handler          []Handler
 | 
			
		||||
	ShortClientName  string
 | 
			
		||||
	LongClientName   string
 | 
			
		||||
	ClientVersion    string
 | 
			
		||||
	Store            *Store
 | 
			
		||||
}
 | 
			
		||||
func NewConnWithOptions(opt *Options) (*Conn, error) {
 | 
			
		||||
	if opt == nil {
 | 
			
		||||
		return nil, ErrOptionsNotProvided
 | 
			
		||||
	}
 | 
			
		||||
	wac := &Conn{
 | 
			
		||||
		handler:    make([]Handler, 0),
 | 
			
		||||
		msgCount:   0,
 | 
			
		||||
		msgTimeout: timeout,
 | 
			
		||||
		msgTimeout: opt.Timeout,
 | 
			
		||||
		Store:      newStore(),
 | 
			
		||||
 | 
			
		||||
		longClientName:  "github.com/rhymen/go-whatsapp",
 | 
			
		||||
		longClientName:  "github.com/Rhymen/go-whatsapp",
 | 
			
		||||
		shortClientName: "go-whatsapp",
 | 
			
		||||
		clientVersion:   "0.1.0",
 | 
			
		||||
		Proxy:           proxy,
 | 
			
		||||
	}
 | 
			
		||||
	if opt.Handler != nil {
 | 
			
		||||
		wac.handler = opt.Handler
 | 
			
		||||
	}
 | 
			
		||||
	if opt.Store != nil {
 | 
			
		||||
		wac.Store = opt.Store
 | 
			
		||||
	}
 | 
			
		||||
	if opt.Proxy != nil {
 | 
			
		||||
		wac.Proxy = opt.Proxy
 | 
			
		||||
	}
 | 
			
		||||
	if len(opt.ShortClientName) != 0 {
 | 
			
		||||
		wac.shortClientName = opt.ShortClientName
 | 
			
		||||
	}
 | 
			
		||||
	if len(opt.LongClientName) != 0 {
 | 
			
		||||
		wac.longClientName = opt.LongClientName
 | 
			
		||||
	}
 | 
			
		||||
	if len(opt.ClientVersion) != 0 {
 | 
			
		||||
		wac.clientVersion = opt.ClientVersion
 | 
			
		||||
	}
 | 
			
		||||
	return wac, wac.connect()
 | 
			
		||||
}
 | 
			
		||||
@@ -249,10 +277,26 @@ func (wac *Conn) keepAlive(minIntervalMs int, maxIntervalMs int) {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (wac *Conn) GetConnected() bool {
 | 
			
		||||
	return  wac.connected
 | 
			
		||||
// IsConnected returns whether the server connection is established or not
 | 
			
		||||
func (wac *Conn) IsConnected() bool {
 | 
			
		||||
	return wac.connected
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (wac *Conn) GetLoggedIn() bool {
 | 
			
		||||
	return  wac.loggedIn
 | 
			
		||||
// GetConnected returns whether the server connection is established or not
 | 
			
		||||
//
 | 
			
		||||
// Deprecated: function name is not go idiomatic, use IsConnected instead
 | 
			
		||||
func (wac *Conn) GetConnected() bool {
 | 
			
		||||
	return wac.connected
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//IsLoggedIn returns whether the you are logged in or not
 | 
			
		||||
func (wac *Conn) IsLoggedIn() bool {
 | 
			
		||||
	return wac.loggedIn
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetLoggedIn returns whether the you are logged in or not
 | 
			
		||||
//
 | 
			
		||||
// Deprecated: function name is not go idiomatic, use IsLoggedIn instead.
 | 
			
		||||
func (wac *Conn) GetLoggedIn() bool {
 | 
			
		||||
	return wac.loggedIn
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/Rhymen/go-whatsapp/errors.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/Rhymen/go-whatsapp/errors.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -22,6 +22,8 @@ var (
 | 
			
		||||
	ErrMediaDownloadFailedWith404 = errors.New("download failed with status code 404")
 | 
			
		||||
	ErrMediaDownloadFailedWith410 = errors.New("download failed with status code 410")
 | 
			
		||||
	ErrInvalidWebsocket           = errors.New("invalid websocket")
 | 
			
		||||
	ErrMessageTypeNotImplemented  = errors.New("message type not implemented")
 | 
			
		||||
	ErrOptionsNotProvided         = errors.New("new conn options not provided")
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type ErrConnectionFailed struct {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								vendor/github.com/Rhymen/go-whatsapp/go.sum
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/Rhymen/go-whatsapp/go.sum
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -32,5 +32,6 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6Zh
 | 
			
		||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 | 
			
		||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 | 
			
		||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
			
		||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
 | 
			
		||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 | 
			
		||||
google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										36
									
								
								vendor/github.com/Rhymen/go-whatsapp/media.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								vendor/github.com/Rhymen/go-whatsapp/media.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -38,7 +38,7 @@ func Download(url string, mediaKey []byte, appInfo MediaType, fileLength int) ([
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	if len(data) != fileLength {
 | 
			
		||||
		return nil, fmt.Errorf("file length does not match")
 | 
			
		||||
		return nil, fmt.Errorf("file length does not match. Expected: %v, got: %v", fileLength, len(data))
 | 
			
		||||
	}
 | 
			
		||||
	return data, nil
 | 
			
		||||
}
 | 
			
		||||
@@ -93,21 +93,21 @@ func downloadMedia(url string) (file []byte, mac []byte, err error) {
 | 
			
		||||
	return data[:n-10], data[n-10 : n], nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
                                                                                
 | 
			
		||||
type MediaConn struct {                                                         
 | 
			
		||||
        Status int `json:"status"`                                              
 | 
			
		||||
        MediaConn struct {                                                      
 | 
			
		||||
                Auth string `json:"auth"`                                       
 | 
			
		||||
                TTL int `json:"ttl"`                                            
 | 
			
		||||
                Hosts []struct {                                                
 | 
			
		||||
                        Hostname string `json:"hostname"`                       
 | 
			
		||||
                        IPs []interface{}  `json:"ips"`                                              
 | 
			
		||||
                } `json:"hosts"`                                                
 | 
			
		||||
        } `json:"media_conn"`                                                   
 | 
			
		||||
type MediaConn struct {
 | 
			
		||||
	Status    int `json:"status"`
 | 
			
		||||
	MediaConn struct {
 | 
			
		||||
		Auth  string `json:"auth"`
 | 
			
		||||
		TTL   int    `json:"ttl"`
 | 
			
		||||
		Hosts []struct {
 | 
			
		||||
			Hostname string `json:"hostname"`
 | 
			
		||||
			IPs      []struct {
 | 
			
		||||
				IP4 string `json:"ip4"`
 | 
			
		||||
				IP6 string `json:"ip6"`
 | 
			
		||||
			} `json:"ips"`
 | 
			
		||||
		} `json:"hosts"`
 | 
			
		||||
	} `json:"media_conn"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func (wac *Conn) queryMediaConn() (hostname, auth string, ttl int, err error) {
 | 
			
		||||
	queryReq := []interface{}{"query", "mediaConn"}
 | 
			
		||||
	ch, err := wac.writeJson(queryReq)
 | 
			
		||||
@@ -131,7 +131,7 @@ func (wac *Conn) queryMediaConn() (hostname, auth string, ttl int, err error) {
 | 
			
		||||
 | 
			
		||||
	var host string
 | 
			
		||||
	for _, h := range resp.MediaConn.Hosts {
 | 
			
		||||
		if h.Hostname!="" {
 | 
			
		||||
		if h.Hostname != "" {
 | 
			
		||||
			host = h.Hostname
 | 
			
		||||
			break
 | 
			
		||||
		}
 | 
			
		||||
@@ -143,10 +143,10 @@ func (wac *Conn) queryMediaConn() (hostname, auth string, ttl int, err error) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var mediaTypeMap = map[MediaType]string{
 | 
			
		||||
	MediaImage: "/mms/image",
 | 
			
		||||
	MediaVideo: "/mms/video",
 | 
			
		||||
	MediaImage:    "/mms/image",
 | 
			
		||||
	MediaVideo:    "/mms/video",
 | 
			
		||||
	MediaDocument: "/mms/document",
 | 
			
		||||
	MediaAudio: "/mms/audio",
 | 
			
		||||
	MediaAudio:    "/mms/audio",
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (wac *Conn) Upload(reader io.Reader, appInfo MediaType) (downloadURL string, mediaKey []byte, fileEncSha256 []byte, fileSha256 []byte, fileLength uint64, err error) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										17
									
								
								vendor/github.com/Rhymen/go-whatsapp/message.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								vendor/github.com/Rhymen/go-whatsapp/message.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -238,7 +238,7 @@ func getMessageInfo(msg *proto.WebMessageInfo) MessageInfo {
 | 
			
		||||
	return MessageInfo{
 | 
			
		||||
		Id:        msg.GetKey().GetId(),
 | 
			
		||||
		RemoteJid: msg.GetKey().GetRemoteJid(),
 | 
			
		||||
		SenderJid: msg.GetKey().GetParticipant(),
 | 
			
		||||
		SenderJid: msg.GetParticipant(),
 | 
			
		||||
		FromMe:    msg.GetKey().GetFromMe(),
 | 
			
		||||
		Timestamp: msg.GetMessageTimestamp(),
 | 
			
		||||
		Status:    MessageStatus(msg.GetStatus()),
 | 
			
		||||
@@ -838,19 +838,16 @@ func ParseProtoMessage(msg *proto.WebMessageInfo) interface{} {
 | 
			
		||||
 | 
			
		||||
	default:
 | 
			
		||||
		//cannot match message
 | 
			
		||||
 | 
			
		||||
		return ErrMessageTypeNotImplemented
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
BatteryMessage represents a battery level and charging state.
 | 
			
		||||
*/
 | 
			
		||||
type BatteryMessage struct {
 | 
			
		||||
	Plugged bool
 | 
			
		||||
	Powersave bool
 | 
			
		||||
	Plugged    bool
 | 
			
		||||
	Powersave  bool
 | 
			
		||||
	Percentage int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -859,8 +856,8 @@ func getBatteryMessage(msg map[string]string) BatteryMessage {
 | 
			
		||||
	powersave, _ := strconv.ParseBool(msg["powersave"])
 | 
			
		||||
	percentage, _ := strconv.Atoi(msg["value"])
 | 
			
		||||
	batteryMessage := BatteryMessage{
 | 
			
		||||
		Plugged: plugged,
 | 
			
		||||
		Powersave: powersave,
 | 
			
		||||
		Plugged:    plugged,
 | 
			
		||||
		Powersave:  powersave,
 | 
			
		||||
		Percentage: percentage,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -869,7 +866,7 @@ func getBatteryMessage(msg map[string]string) BatteryMessage {
 | 
			
		||||
 | 
			
		||||
func getNewContact(msg map[string]string) Contact {
 | 
			
		||||
	contact := Contact{
 | 
			
		||||
		Jid: msg["jid"],
 | 
			
		||||
		Jid:    msg["jid"],
 | 
			
		||||
		Notify: msg["notify"],
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/github.com/Rhymen/go-whatsapp/read.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/Rhymen/go-whatsapp/read.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -62,6 +62,10 @@ func (wac *Conn) processReadData(msgType int, msg []byte) error {
 | 
			
		||||
		data[0] = "!"
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(data) == 2 && len(data[1]) == 0 {
 | 
			
		||||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(data) != 2 || len(data[1]) == 0 {
 | 
			
		||||
		return ErrInvalidWsData
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								vendor/github.com/gomarkdown/markdown/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/github.com/gomarkdown/markdown/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -6,11 +6,7 @@ Package `github.com/gomarkdown/markdown` is a very fast Go library for parsing [
 | 
			
		||||
 | 
			
		||||
It's fast and supports common extensions.
 | 
			
		||||
 | 
			
		||||
## Installation
 | 
			
		||||
 | 
			
		||||
    go get -u github.com/gomarkdown/markdown
 | 
			
		||||
 | 
			
		||||
API Docs:
 | 
			
		||||
## API Docs:
 | 
			
		||||
 | 
			
		||||
- https://godoc.org/github.com/gomarkdown/markdown : top level package
 | 
			
		||||
- https://godoc.org/github.com/gomarkdown/markdown/ast : defines abstract syntax tree of parsed markdown document
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								vendor/github.com/gomarkdown/markdown/ast/node.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								vendor/github.com/gomarkdown/markdown/ast/node.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -250,11 +250,12 @@ type Del struct {
 | 
			
		||||
type Link struct {
 | 
			
		||||
	Container
 | 
			
		||||
 | 
			
		||||
	Destination []byte // Destination is what goes into a href
 | 
			
		||||
	Title       []byte // Title is the tooltip thing that goes in a title attribute
 | 
			
		||||
	NoteID      int    // NoteID contains a serial number of a footnote, zero if it's not a footnote
 | 
			
		||||
	Footnote    Node   // If it's a footnote, this is a direct link to the footnote Node. Otherwise nil.
 | 
			
		||||
	DeferredID  []byte // If a deferred link this holds the original ID.
 | 
			
		||||
	Destination          []byte   // Destination is what goes into a href
 | 
			
		||||
	Title                []byte   // Title is the tooltip thing that goes in a title attribute
 | 
			
		||||
	NoteID               int      // NoteID contains a serial number of a footnote, zero if it's not a footnote
 | 
			
		||||
	Footnote             Node     // If it's a footnote, this is a direct link to the footnote Node. Otherwise nil.
 | 
			
		||||
	DeferredID           []byte   // If a deferred link this holds the original ID.
 | 
			
		||||
	AdditionalAttributes []string // Defines additional attributes to use during rendering.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CrossReference is a reference node.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										42
									
								
								vendor/github.com/gomarkdown/markdown/html/callouts.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										42
									
								
								vendor/github.com/gomarkdown/markdown/html/callouts.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,42 +0,0 @@
 | 
			
		||||
package html
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"io"
 | 
			
		||||
 | 
			
		||||
	"github.com/gomarkdown/markdown/ast"
 | 
			
		||||
	"github.com/gomarkdown/markdown/parser"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// EscapeHTMLCallouts writes html-escaped d to w. It escapes &, <, > and " characters, *but*
 | 
			
		||||
// expands callouts <<N>> with the callout HTML, i.e. by calling r.callout() with a newly created
 | 
			
		||||
// ast.Callout node.
 | 
			
		||||
func (r *Renderer) EscapeHTMLCallouts(w io.Writer, d []byte) {
 | 
			
		||||
	ld := len(d)
 | 
			
		||||
Parse:
 | 
			
		||||
	for i := 0; i < ld; i++ {
 | 
			
		||||
		for _, comment := range r.opts.Comments {
 | 
			
		||||
			if !bytes.HasPrefix(d[i:], comment) {
 | 
			
		||||
				break
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			lc := len(comment)
 | 
			
		||||
			if i+lc < ld {
 | 
			
		||||
				if id, consumed := parser.IsCallout(d[i+lc:]); consumed > 0 {
 | 
			
		||||
					// We have seen a callout
 | 
			
		||||
					callout := &ast.Callout{ID: id}
 | 
			
		||||
					r.callout(w, callout)
 | 
			
		||||
					i += consumed + lc - 1
 | 
			
		||||
					continue Parse
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		escSeq := Escaper[d[i]]
 | 
			
		||||
		if escSeq != nil {
 | 
			
		||||
			w.Write(escSeq)
 | 
			
		||||
		} else {
 | 
			
		||||
			w.Write([]byte{d[i]})
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										50
									
								
								vendor/github.com/gomarkdown/markdown/html/esc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										50
									
								
								vendor/github.com/gomarkdown/markdown/html/esc.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,50 +0,0 @@
 | 
			
		||||
package html
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"html"
 | 
			
		||||
	"io"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var Escaper = [256][]byte{
 | 
			
		||||
	'&': []byte("&"),
 | 
			
		||||
	'<': []byte("<"),
 | 
			
		||||
	'>': []byte(">"),
 | 
			
		||||
	'"': []byte("""),
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EscapeHTML writes html-escaped d to w. It escapes &, <, > and " characters.
 | 
			
		||||
func EscapeHTML(w io.Writer, d []byte) {
 | 
			
		||||
	var start, end int
 | 
			
		||||
	n := len(d)
 | 
			
		||||
	for end < n {
 | 
			
		||||
		escSeq := Escaper[d[end]]
 | 
			
		||||
		if escSeq != nil {
 | 
			
		||||
			w.Write(d[start:end])
 | 
			
		||||
			w.Write(escSeq)
 | 
			
		||||
			start = end + 1
 | 
			
		||||
		}
 | 
			
		||||
		end++
 | 
			
		||||
	}
 | 
			
		||||
	if start < n && end <= n {
 | 
			
		||||
		w.Write(d[start:end])
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func escLink(w io.Writer, text []byte) {
 | 
			
		||||
	unesc := html.UnescapeString(string(text))
 | 
			
		||||
	EscapeHTML(w, []byte(unesc))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Escape writes the text to w, but skips the escape character.
 | 
			
		||||
func Escape(w io.Writer, text []byte) {
 | 
			
		||||
	esc := false
 | 
			
		||||
	for i := 0; i < len(text); i++ {
 | 
			
		||||
		if text[i] == '\\' {
 | 
			
		||||
			esc = !esc
 | 
			
		||||
		}
 | 
			
		||||
		if esc && text[i] == '\\' {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		w.Write([]byte{text[i]})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										441
									
								
								vendor/github.com/gomarkdown/markdown/html/renderer.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										441
									
								
								vendor/github.com/gomarkdown/markdown/html/renderer.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -3,6 +3,7 @@ package html
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"html"
 | 
			
		||||
	"io"
 | 
			
		||||
	"regexp"
 | 
			
		||||
	"sort"
 | 
			
		||||
@@ -10,6 +11,7 @@ import (
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"github.com/gomarkdown/markdown/ast"
 | 
			
		||||
	"github.com/gomarkdown/markdown/parser"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Flags control optional behavior of HTML renderer.
 | 
			
		||||
@@ -125,13 +127,60 @@ type Renderer struct {
 | 
			
		||||
	headingIDs map[string]int
 | 
			
		||||
 | 
			
		||||
	lastOutputLen int
 | 
			
		||||
	disableTags   int
 | 
			
		||||
 | 
			
		||||
	// if > 0, will strip html tags in Out and Outs
 | 
			
		||||
	DisableTags int
 | 
			
		||||
 | 
			
		||||
	sr *SPRenderer
 | 
			
		||||
 | 
			
		||||
	documentMatter ast.DocumentMatters // keep track of front/main/back matter.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Escaper defines how to escape HTML special characters
 | 
			
		||||
var Escaper = [256][]byte{
 | 
			
		||||
	'&': []byte("&"),
 | 
			
		||||
	'<': []byte("<"),
 | 
			
		||||
	'>': []byte(">"),
 | 
			
		||||
	'"': []byte("""),
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EscapeHTML writes html-escaped d to w. It escapes &, <, > and " characters.
 | 
			
		||||
func EscapeHTML(w io.Writer, d []byte) {
 | 
			
		||||
	var start, end int
 | 
			
		||||
	n := len(d)
 | 
			
		||||
	for end < n {
 | 
			
		||||
		escSeq := Escaper[d[end]]
 | 
			
		||||
		if escSeq != nil {
 | 
			
		||||
			w.Write(d[start:end])
 | 
			
		||||
			w.Write(escSeq)
 | 
			
		||||
			start = end + 1
 | 
			
		||||
		}
 | 
			
		||||
		end++
 | 
			
		||||
	}
 | 
			
		||||
	if start < n && end <= n {
 | 
			
		||||
		w.Write(d[start:end])
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func escLink(w io.Writer, text []byte) {
 | 
			
		||||
	unesc := html.UnescapeString(string(text))
 | 
			
		||||
	EscapeHTML(w, []byte(unesc))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Escape writes the text to w, but skips the escape character.
 | 
			
		||||
func Escape(w io.Writer, text []byte) {
 | 
			
		||||
	esc := false
 | 
			
		||||
	for i := 0; i < len(text); i++ {
 | 
			
		||||
		if text[i] == '\\' {
 | 
			
		||||
			esc = !esc
 | 
			
		||||
		}
 | 
			
		||||
		if esc && text[i] == '\\' {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		w.Write([]byte{text[i]})
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewRenderer creates and configures an Renderer object, which
 | 
			
		||||
// satisfies the Renderer interface.
 | 
			
		||||
func NewRenderer(opts RendererOptions) *Renderer {
 | 
			
		||||
@@ -384,25 +433,28 @@ func skipParagraphTags(para *ast.Paragraph) bool {
 | 
			
		||||
	return tightOrTerm
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) out(w io.Writer, d []byte) {
 | 
			
		||||
// Out is a helper to write data to writer
 | 
			
		||||
func (r *Renderer) Out(w io.Writer, d []byte) {
 | 
			
		||||
	r.lastOutputLen = len(d)
 | 
			
		||||
	if r.disableTags > 0 {
 | 
			
		||||
	if r.DisableTags > 0 {
 | 
			
		||||
		d = htmlTagRe.ReplaceAll(d, []byte{})
 | 
			
		||||
	}
 | 
			
		||||
	w.Write(d)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) outs(w io.Writer, s string) {
 | 
			
		||||
// Outs is a helper to write data to writer
 | 
			
		||||
func (r *Renderer) Outs(w io.Writer, s string) {
 | 
			
		||||
	r.lastOutputLen = len(s)
 | 
			
		||||
	if r.disableTags > 0 {
 | 
			
		||||
	if r.DisableTags > 0 {
 | 
			
		||||
		s = htmlTagRe.ReplaceAllString(s, "")
 | 
			
		||||
	}
 | 
			
		||||
	io.WriteString(w, s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) cr(w io.Writer) {
 | 
			
		||||
// CR writes a new line
 | 
			
		||||
func (r *Renderer) CR(w io.Writer) {
 | 
			
		||||
	if r.lastOutputLen > 0 {
 | 
			
		||||
		r.outs(w, "\n")
 | 
			
		||||
		r.Outs(w, "\n")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -426,11 +478,12 @@ func headingCloseTagFromLevel(level int) string {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) outHRTag(w io.Writer, attrs []string) {
 | 
			
		||||
	hr := tagWithAttributes("<hr", attrs)
 | 
			
		||||
	r.outOneOf(w, r.opts.Flags&UseXHTML == 0, hr, "<hr />")
 | 
			
		||||
	hr := TagWithAttributes("<hr", attrs)
 | 
			
		||||
	r.OutOneOf(w, r.opts.Flags&UseXHTML == 0, hr, "<hr />")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) text(w io.Writer, text *ast.Text) {
 | 
			
		||||
// Text writes ast.Text node
 | 
			
		||||
func (r *Renderer) Text(w io.Writer, text *ast.Text) {
 | 
			
		||||
	if r.opts.Flags&Smartypants != 0 {
 | 
			
		||||
		var tmp bytes.Buffer
 | 
			
		||||
		EscapeHTML(&tmp, text.Literal)
 | 
			
		||||
@@ -445,41 +498,46 @@ func (r *Renderer) text(w io.Writer, text *ast.Text) {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) hardBreak(w io.Writer, node *ast.Hardbreak) {
 | 
			
		||||
	r.outOneOf(w, r.opts.Flags&UseXHTML == 0, "<br>", "<br />")
 | 
			
		||||
	r.cr(w)
 | 
			
		||||
// HardBreak writes ast.Hardbreak node
 | 
			
		||||
func (r *Renderer) HardBreak(w io.Writer, node *ast.Hardbreak) {
 | 
			
		||||
	r.OutOneOf(w, r.opts.Flags&UseXHTML == 0, "<br>", "<br />")
 | 
			
		||||
	r.CR(w)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) nonBlockingSpace(w io.Writer, node *ast.NonBlockingSpace) {
 | 
			
		||||
	r.outs(w, " ")
 | 
			
		||||
// NonBlockingSpace writes ast.NonBlockingSpace node
 | 
			
		||||
func (r *Renderer) NonBlockingSpace(w io.Writer, node *ast.NonBlockingSpace) {
 | 
			
		||||
	r.Outs(w, " ")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) outOneOf(w io.Writer, outFirst bool, first string, second string) {
 | 
			
		||||
// OutOneOf writes first or second depending on outFirst
 | 
			
		||||
func (r *Renderer) OutOneOf(w io.Writer, outFirst bool, first string, second string) {
 | 
			
		||||
	if outFirst {
 | 
			
		||||
		r.outs(w, first)
 | 
			
		||||
		r.Outs(w, first)
 | 
			
		||||
	} else {
 | 
			
		||||
		r.outs(w, second)
 | 
			
		||||
		r.Outs(w, second)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) outOneOfCr(w io.Writer, outFirst bool, first string, second string) {
 | 
			
		||||
// OutOneOfCr writes CR + first or second + CR depending on outFirst
 | 
			
		||||
func (r *Renderer) OutOneOfCr(w io.Writer, outFirst bool, first string, second string) {
 | 
			
		||||
	if outFirst {
 | 
			
		||||
		r.cr(w)
 | 
			
		||||
		r.outs(w, first)
 | 
			
		||||
		r.CR(w)
 | 
			
		||||
		r.Outs(w, first)
 | 
			
		||||
	} else {
 | 
			
		||||
		r.outs(w, second)
 | 
			
		||||
		r.cr(w)
 | 
			
		||||
		r.Outs(w, second)
 | 
			
		||||
		r.CR(w)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) htmlSpan(w io.Writer, span *ast.HTMLSpan) {
 | 
			
		||||
// HTMLSpan writes ast.HTMLSpan node
 | 
			
		||||
func (r *Renderer) HTMLSpan(w io.Writer, span *ast.HTMLSpan) {
 | 
			
		||||
	if r.opts.Flags&SkipHTML == 0 {
 | 
			
		||||
		r.out(w, span.Literal)
 | 
			
		||||
		r.Out(w, span.Literal)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) linkEnter(w io.Writer, link *ast.Link) {
 | 
			
		||||
	var attrs []string
 | 
			
		||||
	attrs := link.AdditionalAttributes
 | 
			
		||||
	dest := link.Destination
 | 
			
		||||
	dest = r.addAbsPrefix(dest)
 | 
			
		||||
	var hrefBuf bytes.Buffer
 | 
			
		||||
@@ -488,7 +546,7 @@ func (r *Renderer) linkEnter(w io.Writer, link *ast.Link) {
 | 
			
		||||
	hrefBuf.WriteByte('"')
 | 
			
		||||
	attrs = append(attrs, hrefBuf.String())
 | 
			
		||||
	if link.NoteID != 0 {
 | 
			
		||||
		r.outs(w, footnoteRef(r.opts.FootnoteAnchorPrefix, link))
 | 
			
		||||
		r.Outs(w, footnoteRef(r.opts.FootnoteAnchorPrefix, link))
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -505,14 +563,15 @@ func (r *Renderer) linkEnter(w io.Writer, link *ast.Link) {
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) linkExit(w io.Writer, link *ast.Link) {
 | 
			
		||||
	if link.NoteID == 0 {
 | 
			
		||||
		r.outs(w, "</a>")
 | 
			
		||||
		r.Outs(w, "</a>")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) link(w io.Writer, link *ast.Link, entering bool) {
 | 
			
		||||
// Link writes ast.Link node
 | 
			
		||||
func (r *Renderer) Link(w io.Writer, link *ast.Link, entering bool) {
 | 
			
		||||
	// mark it but don't link it if it is not a safe link: no smartypants
 | 
			
		||||
	if needSkipLink(r.opts.Flags, link.Destination) {
 | 
			
		||||
		r.outOneOf(w, entering, "<tt>", "</tt>")
 | 
			
		||||
		r.OutOneOf(w, entering, "<tt>", "</tt>")
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -526,26 +585,35 @@ func (r *Renderer) link(w io.Writer, link *ast.Link, entering bool) {
 | 
			
		||||
func (r *Renderer) imageEnter(w io.Writer, image *ast.Image) {
 | 
			
		||||
	dest := image.Destination
 | 
			
		||||
	dest = r.addAbsPrefix(dest)
 | 
			
		||||
	if r.disableTags == 0 {
 | 
			
		||||
	if r.DisableTags == 0 {
 | 
			
		||||
		//if options.safe && potentiallyUnsafe(dest) {
 | 
			
		||||
		//out(w, `<img src="" alt="`)
 | 
			
		||||
		//} else {
 | 
			
		||||
		r.outs(w, `<img src="`)
 | 
			
		||||
		r.Outs(w, `<img src="`)
 | 
			
		||||
		escLink(w, dest)
 | 
			
		||||
		r.outs(w, `" alt="`)
 | 
			
		||||
		r.Outs(w, `" alt="`)
 | 
			
		||||
		//}
 | 
			
		||||
	}
 | 
			
		||||
	r.disableTags++
 | 
			
		||||
	r.DisableTags++
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) imageExit(w io.Writer, image *ast.Image) {
 | 
			
		||||
	r.disableTags--
 | 
			
		||||
	if r.disableTags == 0 {
 | 
			
		||||
	r.DisableTags--
 | 
			
		||||
	if r.DisableTags == 0 {
 | 
			
		||||
		if image.Title != nil {
 | 
			
		||||
			r.outs(w, `" title="`)
 | 
			
		||||
			r.Outs(w, `" title="`)
 | 
			
		||||
			EscapeHTML(w, image.Title)
 | 
			
		||||
		}
 | 
			
		||||
		r.outs(w, `" />`)
 | 
			
		||||
		r.Outs(w, `" />`)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Image writes ast.Image node
 | 
			
		||||
func (r *Renderer) Image(w io.Writer, node *ast.Image, entering bool) {
 | 
			
		||||
	if entering {
 | 
			
		||||
		r.imageEnter(w, node)
 | 
			
		||||
	} else {
 | 
			
		||||
		r.imageExit(w, node)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -556,33 +624,34 @@ func (r *Renderer) paragraphEnter(w io.Writer, para *ast.Paragraph) {
 | 
			
		||||
	if prev != nil {
 | 
			
		||||
		switch prev.(type) {
 | 
			
		||||
		case *ast.HTMLBlock, *ast.List, *ast.Paragraph, *ast.Heading, *ast.CaptionFigure, *ast.CodeBlock, *ast.BlockQuote, *ast.Aside, *ast.HorizontalRule:
 | 
			
		||||
			r.cr(w)
 | 
			
		||||
			r.CR(w)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if prev == nil {
 | 
			
		||||
		_, isParentBlockQuote := para.Parent.(*ast.BlockQuote)
 | 
			
		||||
		if isParentBlockQuote {
 | 
			
		||||
			r.cr(w)
 | 
			
		||||
			r.CR(w)
 | 
			
		||||
		}
 | 
			
		||||
		_, isParentAside := para.Parent.(*ast.Aside)
 | 
			
		||||
		if isParentAside {
 | 
			
		||||
			r.cr(w)
 | 
			
		||||
			r.CR(w)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	tag := tagWithAttributes("<p", BlockAttrs(para))
 | 
			
		||||
	r.outs(w, tag)
 | 
			
		||||
	tag := TagWithAttributes("<p", BlockAttrs(para))
 | 
			
		||||
	r.Outs(w, tag)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) paragraphExit(w io.Writer, para *ast.Paragraph) {
 | 
			
		||||
	r.outs(w, "</p>")
 | 
			
		||||
	r.Outs(w, "</p>")
 | 
			
		||||
	if !(isListItem(para.Parent) && ast.GetNextNode(para) == nil) {
 | 
			
		||||
		r.cr(w)
 | 
			
		||||
		r.CR(w)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) paragraph(w io.Writer, para *ast.Paragraph, entering bool) {
 | 
			
		||||
// Paragraph writes ast.Paragraph node
 | 
			
		||||
func (r *Renderer) Paragraph(w io.Writer, para *ast.Paragraph, entering bool) {
 | 
			
		||||
	if skipParagraphTags(para) {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
@@ -592,27 +661,22 @@ func (r *Renderer) paragraph(w io.Writer, para *ast.Paragraph, entering bool) {
 | 
			
		||||
		r.paragraphExit(w, para)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
func (r *Renderer) image(w io.Writer, node *ast.Image, entering bool) {
 | 
			
		||||
	if entering {
 | 
			
		||||
		r.imageEnter(w, node)
 | 
			
		||||
	} else {
 | 
			
		||||
		r.imageExit(w, node)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) code(w io.Writer, node *ast.Code) {
 | 
			
		||||
	r.outs(w, "<code>")
 | 
			
		||||
// Code writes ast.Code node
 | 
			
		||||
func (r *Renderer) Code(w io.Writer, node *ast.Code) {
 | 
			
		||||
	r.Outs(w, "<code>")
 | 
			
		||||
	EscapeHTML(w, node.Literal)
 | 
			
		||||
	r.outs(w, "</code>")
 | 
			
		||||
	r.Outs(w, "</code>")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) htmlBlock(w io.Writer, node *ast.HTMLBlock) {
 | 
			
		||||
// HTMLBlock write ast.HTMLBlock node
 | 
			
		||||
func (r *Renderer) HTMLBlock(w io.Writer, node *ast.HTMLBlock) {
 | 
			
		||||
	if r.opts.Flags&SkipHTML != 0 {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	r.cr(w)
 | 
			
		||||
	r.out(w, node.Literal)
 | 
			
		||||
	r.cr(w)
 | 
			
		||||
	r.CR(w)
 | 
			
		||||
	r.Out(w, node.Literal)
 | 
			
		||||
	r.CR(w)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) headingEnter(w io.Writer, nodeData *ast.Heading) {
 | 
			
		||||
@@ -644,18 +708,19 @@ func (r *Renderer) headingEnter(w io.Writer, nodeData *ast.Heading) {
 | 
			
		||||
		attrs = append(attrs, attrID)
 | 
			
		||||
	}
 | 
			
		||||
	attrs = append(attrs, BlockAttrs(nodeData)...)
 | 
			
		||||
	r.cr(w)
 | 
			
		||||
	r.CR(w)
 | 
			
		||||
	r.outTag(w, headingOpenTagFromLevel(nodeData.Level), attrs)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) headingExit(w io.Writer, heading *ast.Heading) {
 | 
			
		||||
	r.outs(w, headingCloseTagFromLevel(heading.Level))
 | 
			
		||||
	r.Outs(w, headingCloseTagFromLevel(heading.Level))
 | 
			
		||||
	if !(isListItem(heading.Parent) && ast.GetNextNode(heading) == nil) {
 | 
			
		||||
		r.cr(w)
 | 
			
		||||
		r.CR(w)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) heading(w io.Writer, node *ast.Heading, entering bool) {
 | 
			
		||||
// Heading writes ast.Heading node
 | 
			
		||||
func (r *Renderer) Heading(w io.Writer, node *ast.Heading, entering bool) {
 | 
			
		||||
	if entering {
 | 
			
		||||
		r.headingEnter(w, node)
 | 
			
		||||
	} else {
 | 
			
		||||
@@ -663,10 +728,11 @@ func (r *Renderer) heading(w io.Writer, node *ast.Heading, entering bool) {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) horizontalRule(w io.Writer, node *ast.HorizontalRule) {
 | 
			
		||||
	r.cr(w)
 | 
			
		||||
// HorizontalRule writes ast.HorizontalRule node
 | 
			
		||||
func (r *Renderer) HorizontalRule(w io.Writer, node *ast.HorizontalRule) {
 | 
			
		||||
	r.CR(w)
 | 
			
		||||
	r.outHRTag(w, BlockAttrs(node))
 | 
			
		||||
	r.cr(w)
 | 
			
		||||
	r.CR(w)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) listEnter(w io.Writer, nodeData *ast.List) {
 | 
			
		||||
@@ -674,17 +740,17 @@ func (r *Renderer) listEnter(w io.Writer, nodeData *ast.List) {
 | 
			
		||||
	var attrs []string
 | 
			
		||||
 | 
			
		||||
	if nodeData.IsFootnotesList {
 | 
			
		||||
		r.outs(w, "\n<div class=\"footnotes\">\n\n")
 | 
			
		||||
		r.Outs(w, "\n<div class=\"footnotes\">\n\n")
 | 
			
		||||
		if r.opts.Flags&FootnoteNoHRTag == 0 {
 | 
			
		||||
			r.outHRTag(w, nil)
 | 
			
		||||
			r.cr(w)
 | 
			
		||||
			r.CR(w)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	r.cr(w)
 | 
			
		||||
	r.CR(w)
 | 
			
		||||
	if isListItem(nodeData.Parent) {
 | 
			
		||||
		grand := nodeData.Parent.GetParent()
 | 
			
		||||
		if isListTight(grand) {
 | 
			
		||||
			r.cr(w)
 | 
			
		||||
			r.CR(w)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -700,7 +766,7 @@ func (r *Renderer) listEnter(w io.Writer, nodeData *ast.List) {
 | 
			
		||||
	}
 | 
			
		||||
	attrs = append(attrs, BlockAttrs(nodeData)...)
 | 
			
		||||
	r.outTag(w, openTag, attrs)
 | 
			
		||||
	r.cr(w)
 | 
			
		||||
	r.CR(w)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) listExit(w io.Writer, list *ast.List) {
 | 
			
		||||
@@ -711,7 +777,7 @@ func (r *Renderer) listExit(w io.Writer, list *ast.List) {
 | 
			
		||||
	if list.ListFlags&ast.ListTypeDefinition != 0 {
 | 
			
		||||
		closeTag = "</dl>"
 | 
			
		||||
	}
 | 
			
		||||
	r.outs(w, closeTag)
 | 
			
		||||
	r.Outs(w, closeTag)
 | 
			
		||||
 | 
			
		||||
	//cr(w)
 | 
			
		||||
	//if node.parent.Type != Item {
 | 
			
		||||
@@ -721,18 +787,19 @@ func (r *Renderer) listExit(w io.Writer, list *ast.List) {
 | 
			
		||||
	switch parent.(type) {
 | 
			
		||||
	case *ast.ListItem:
 | 
			
		||||
		if ast.GetNextNode(list) != nil {
 | 
			
		||||
			r.cr(w)
 | 
			
		||||
			r.CR(w)
 | 
			
		||||
		}
 | 
			
		||||
	case *ast.Document, *ast.BlockQuote, *ast.Aside:
 | 
			
		||||
		r.cr(w)
 | 
			
		||||
		r.CR(w)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if list.IsFootnotesList {
 | 
			
		||||
		r.outs(w, "\n</div>\n")
 | 
			
		||||
		r.Outs(w, "\n</div>\n")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) list(w io.Writer, list *ast.List, entering bool) {
 | 
			
		||||
// List writes ast.List node
 | 
			
		||||
func (r *Renderer) List(w io.Writer, list *ast.List, entering bool) {
 | 
			
		||||
	if entering {
 | 
			
		||||
		r.listEnter(w, list)
 | 
			
		||||
	} else {
 | 
			
		||||
@@ -742,11 +809,11 @@ func (r *Renderer) list(w io.Writer, list *ast.List, entering bool) {
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) listItemEnter(w io.Writer, listItem *ast.ListItem) {
 | 
			
		||||
	if listItemOpenCR(listItem) {
 | 
			
		||||
		r.cr(w)
 | 
			
		||||
		r.CR(w)
 | 
			
		||||
	}
 | 
			
		||||
	if listItem.RefLink != nil {
 | 
			
		||||
		slug := slugify(listItem.RefLink)
 | 
			
		||||
		r.outs(w, footnoteItem(r.opts.FootnoteAnchorPrefix, slug))
 | 
			
		||||
		r.Outs(w, footnoteItem(r.opts.FootnoteAnchorPrefix, slug))
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -757,7 +824,7 @@ func (r *Renderer) listItemEnter(w io.Writer, listItem *ast.ListItem) {
 | 
			
		||||
	if listItem.ListFlags&ast.ListTypeTerm != 0 {
 | 
			
		||||
		openTag = "<dt>"
 | 
			
		||||
	}
 | 
			
		||||
	r.outs(w, openTag)
 | 
			
		||||
	r.Outs(w, openTag)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) listItemExit(w io.Writer, listItem *ast.ListItem) {
 | 
			
		||||
@@ -766,7 +833,7 @@ func (r *Renderer) listItemExit(w io.Writer, listItem *ast.ListItem) {
 | 
			
		||||
		prefix := r.opts.FootnoteAnchorPrefix
 | 
			
		||||
		link := r.opts.FootnoteReturnLinkContents
 | 
			
		||||
		s := footnoteReturnLink(prefix, link, slug)
 | 
			
		||||
		r.outs(w, s)
 | 
			
		||||
		r.Outs(w, s)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	closeTag := "</li>"
 | 
			
		||||
@@ -776,11 +843,12 @@ func (r *Renderer) listItemExit(w io.Writer, listItem *ast.ListItem) {
 | 
			
		||||
	if listItem.ListFlags&ast.ListTypeTerm != 0 {
 | 
			
		||||
		closeTag = "</dt>"
 | 
			
		||||
	}
 | 
			
		||||
	r.outs(w, closeTag)
 | 
			
		||||
	r.cr(w)
 | 
			
		||||
	r.Outs(w, closeTag)
 | 
			
		||||
	r.CR(w)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) listItem(w io.Writer, listItem *ast.ListItem, entering bool) {
 | 
			
		||||
// ListItem writes ast.ListItem node
 | 
			
		||||
func (r *Renderer) ListItem(w io.Writer, listItem *ast.ListItem, entering bool) {
 | 
			
		||||
	if entering {
 | 
			
		||||
		r.listItemEnter(w, listItem)
 | 
			
		||||
	} else {
 | 
			
		||||
@@ -788,38 +856,74 @@ func (r *Renderer) listItem(w io.Writer, listItem *ast.ListItem, entering bool)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) codeBlock(w io.Writer, codeBlock *ast.CodeBlock) {
 | 
			
		||||
// EscapeHTMLCallouts writes html-escaped d to w. It escapes &, <, > and " characters, *but*
 | 
			
		||||
// expands callouts <<N>> with the callout HTML, i.e. by calling r.callout() with a newly created
 | 
			
		||||
// ast.Callout node.
 | 
			
		||||
func (r *Renderer) EscapeHTMLCallouts(w io.Writer, d []byte) {
 | 
			
		||||
	ld := len(d)
 | 
			
		||||
Parse:
 | 
			
		||||
	for i := 0; i < ld; i++ {
 | 
			
		||||
		for _, comment := range r.opts.Comments {
 | 
			
		||||
			if !bytes.HasPrefix(d[i:], comment) {
 | 
			
		||||
				break
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			lc := len(comment)
 | 
			
		||||
			if i+lc < ld {
 | 
			
		||||
				if id, consumed := parser.IsCallout(d[i+lc:]); consumed > 0 {
 | 
			
		||||
					// We have seen a callout
 | 
			
		||||
					callout := &ast.Callout{ID: id}
 | 
			
		||||
					r.Callout(w, callout)
 | 
			
		||||
					i += consumed + lc - 1
 | 
			
		||||
					continue Parse
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		escSeq := Escaper[d[i]]
 | 
			
		||||
		if escSeq != nil {
 | 
			
		||||
			w.Write(escSeq)
 | 
			
		||||
		} else {
 | 
			
		||||
			w.Write([]byte{d[i]})
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// CodeBlock writes ast.CodeBlock node
 | 
			
		||||
func (r *Renderer) CodeBlock(w io.Writer, codeBlock *ast.CodeBlock) {
 | 
			
		||||
	var attrs []string
 | 
			
		||||
	// TODO(miek): this can add multiple class= attribute, they should be coalesced into one.
 | 
			
		||||
	// This is probably true for some other elements as well
 | 
			
		||||
	attrs = appendLanguageAttr(attrs, codeBlock.Info)
 | 
			
		||||
	attrs = append(attrs, BlockAttrs(codeBlock)...)
 | 
			
		||||
	r.cr(w)
 | 
			
		||||
	r.CR(w)
 | 
			
		||||
 | 
			
		||||
	r.outs(w, "<pre>")
 | 
			
		||||
	code := tagWithAttributes("<code", attrs)
 | 
			
		||||
	r.outs(w, code)
 | 
			
		||||
	r.Outs(w, "<pre>")
 | 
			
		||||
	code := TagWithAttributes("<code", attrs)
 | 
			
		||||
	r.Outs(w, code)
 | 
			
		||||
	if r.opts.Comments != nil {
 | 
			
		||||
		r.EscapeHTMLCallouts(w, codeBlock.Literal)
 | 
			
		||||
	} else {
 | 
			
		||||
		EscapeHTML(w, codeBlock.Literal)
 | 
			
		||||
	}
 | 
			
		||||
	r.outs(w, "</code>")
 | 
			
		||||
	r.outs(w, "</pre>")
 | 
			
		||||
	r.Outs(w, "</code>")
 | 
			
		||||
	r.Outs(w, "</pre>")
 | 
			
		||||
	if !isListItem(codeBlock.Parent) {
 | 
			
		||||
		r.cr(w)
 | 
			
		||||
		r.CR(w)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) caption(w io.Writer, caption *ast.Caption, entering bool) {
 | 
			
		||||
// Caption writes ast.Caption node
 | 
			
		||||
func (r *Renderer) Caption(w io.Writer, caption *ast.Caption, entering bool) {
 | 
			
		||||
	if entering {
 | 
			
		||||
		r.outs(w, "<figcaption>")
 | 
			
		||||
		r.Outs(w, "<figcaption>")
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	r.outs(w, "</figcaption>")
 | 
			
		||||
	r.Outs(w, "</figcaption>")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) captionFigure(w io.Writer, figure *ast.CaptionFigure, entering bool) {
 | 
			
		||||
// CaptionFigure writes ast.CaptionFigure node
 | 
			
		||||
func (r *Renderer) CaptionFigure(w io.Writer, figure *ast.CaptionFigure, entering bool) {
 | 
			
		||||
	// TODO(miek): copy more generic ways of mmark over to here.
 | 
			
		||||
	fig := "<figure"
 | 
			
		||||
	if figure.HeadingID != "" {
 | 
			
		||||
@@ -827,13 +931,14 @@ func (r *Renderer) captionFigure(w io.Writer, figure *ast.CaptionFigure, enterin
 | 
			
		||||
	} else {
 | 
			
		||||
		fig += ">"
 | 
			
		||||
	}
 | 
			
		||||
	r.outOneOf(w, entering, fig, "\n</figure>\n")
 | 
			
		||||
	r.OutOneOf(w, entering, fig, "\n</figure>\n")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) tableCell(w io.Writer, tableCell *ast.TableCell, entering bool) {
 | 
			
		||||
// TableCell writes ast.TableCell node
 | 
			
		||||
func (r *Renderer) TableCell(w io.Writer, tableCell *ast.TableCell, entering bool) {
 | 
			
		||||
	if !entering {
 | 
			
		||||
		r.outOneOf(w, tableCell.IsHeader, "</th>", "</td>")
 | 
			
		||||
		r.cr(w)
 | 
			
		||||
		r.OutOneOf(w, tableCell.IsHeader, "</th>", "</td>")
 | 
			
		||||
		r.CR(w)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -848,44 +953,47 @@ func (r *Renderer) tableCell(w io.Writer, tableCell *ast.TableCell, entering boo
 | 
			
		||||
		attrs = append(attrs, fmt.Sprintf(`align="%s"`, align))
 | 
			
		||||
	}
 | 
			
		||||
	if ast.GetPrevNode(tableCell) == nil {
 | 
			
		||||
		r.cr(w)
 | 
			
		||||
		r.CR(w)
 | 
			
		||||
	}
 | 
			
		||||
	r.outTag(w, openTag, attrs)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) tableBody(w io.Writer, node *ast.TableBody, entering bool) {
 | 
			
		||||
// TableBody writes ast.TableBody node
 | 
			
		||||
func (r *Renderer) TableBody(w io.Writer, node *ast.TableBody, entering bool) {
 | 
			
		||||
	if entering {
 | 
			
		||||
		r.cr(w)
 | 
			
		||||
		r.outs(w, "<tbody>")
 | 
			
		||||
		r.CR(w)
 | 
			
		||||
		r.Outs(w, "<tbody>")
 | 
			
		||||
		// XXX: this is to adhere to a rather silly test. Should fix test.
 | 
			
		||||
		if ast.GetFirstChild(node) == nil {
 | 
			
		||||
			r.cr(w)
 | 
			
		||||
			r.CR(w)
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		r.outs(w, "</tbody>")
 | 
			
		||||
		r.cr(w)
 | 
			
		||||
		r.Outs(w, "</tbody>")
 | 
			
		||||
		r.CR(w)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) matter(w io.Writer, node *ast.DocumentMatter, entering bool) {
 | 
			
		||||
// DocumentMatter writes ast.DocumentMatter
 | 
			
		||||
func (r *Renderer) DocumentMatter(w io.Writer, node *ast.DocumentMatter, entering bool) {
 | 
			
		||||
	if !entering {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if r.documentMatter != ast.DocumentMatterNone {
 | 
			
		||||
		r.outs(w, "</section>\n")
 | 
			
		||||
		r.Outs(w, "</section>\n")
 | 
			
		||||
	}
 | 
			
		||||
	switch node.Matter {
 | 
			
		||||
	case ast.DocumentMatterFront:
 | 
			
		||||
		r.outs(w, `<section data-matter="front">`)
 | 
			
		||||
		r.Outs(w, `<section data-matter="front">`)
 | 
			
		||||
	case ast.DocumentMatterMain:
 | 
			
		||||
		r.outs(w, `<section data-matter="main">`)
 | 
			
		||||
		r.Outs(w, `<section data-matter="main">`)
 | 
			
		||||
	case ast.DocumentMatterBack:
 | 
			
		||||
		r.outs(w, `<section data-matter="back">`)
 | 
			
		||||
		r.Outs(w, `<section data-matter="back">`)
 | 
			
		||||
	}
 | 
			
		||||
	r.documentMatter = node.Matter
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) citation(w io.Writer, node *ast.Citation) {
 | 
			
		||||
// Citation writes ast.Citation node
 | 
			
		||||
func (r *Renderer) Citation(w io.Writer, node *ast.Citation) {
 | 
			
		||||
	for i, c := range node.Destination {
 | 
			
		||||
		attr := []string{`class="none"`}
 | 
			
		||||
		switch node.Type[i] {
 | 
			
		||||
@@ -897,23 +1005,25 @@ func (r *Renderer) citation(w io.Writer, node *ast.Citation) {
 | 
			
		||||
			attr[0] = `class="suppressed"`
 | 
			
		||||
		}
 | 
			
		||||
		r.outTag(w, "<cite", attr)
 | 
			
		||||
		r.outs(w, fmt.Sprintf(`<a href="#%s">`+r.opts.CitationFormatString+`</a>`, c, c))
 | 
			
		||||
		r.outs(w, "</cite>")
 | 
			
		||||
		r.Outs(w, fmt.Sprintf(`<a href="#%s">`+r.opts.CitationFormatString+`</a>`, c, c))
 | 
			
		||||
		r.Outs(w, "</cite>")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) callout(w io.Writer, node *ast.Callout) {
 | 
			
		||||
// Callout writes ast.Callout node
 | 
			
		||||
func (r *Renderer) Callout(w io.Writer, node *ast.Callout) {
 | 
			
		||||
	attr := []string{`class="callout"`}
 | 
			
		||||
	r.outTag(w, "<span", attr)
 | 
			
		||||
	r.out(w, node.ID)
 | 
			
		||||
	r.outs(w, "</span>")
 | 
			
		||||
	r.Out(w, node.ID)
 | 
			
		||||
	r.Outs(w, "</span>")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Renderer) index(w io.Writer, node *ast.Index) {
 | 
			
		||||
// Index writes ast.Index node
 | 
			
		||||
func (r *Renderer) Index(w io.Writer, node *ast.Index) {
 | 
			
		||||
	// there is no in-text representation.
 | 
			
		||||
	attr := []string{`class="index"`, fmt.Sprintf(`id="%s"`, node.ID)}
 | 
			
		||||
	r.outTag(w, "<span", attr)
 | 
			
		||||
	r.outs(w, "</span>")
 | 
			
		||||
	r.Outs(w, "</span>")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RenderNode renders a markdown node to HTML
 | 
			
		||||
@@ -926,102 +1036,102 @@ func (r *Renderer) RenderNode(w io.Writer, node ast.Node, entering bool) ast.Wal
 | 
			
		||||
	}
 | 
			
		||||
	switch node := node.(type) {
 | 
			
		||||
	case *ast.Text:
 | 
			
		||||
		r.text(w, node)
 | 
			
		||||
		r.Text(w, node)
 | 
			
		||||
	case *ast.Softbreak:
 | 
			
		||||
		r.cr(w)
 | 
			
		||||
		r.CR(w)
 | 
			
		||||
		// TODO: make it configurable via out(renderer.softbreak)
 | 
			
		||||
	case *ast.Hardbreak:
 | 
			
		||||
		r.hardBreak(w, node)
 | 
			
		||||
		r.HardBreak(w, node)
 | 
			
		||||
	case *ast.NonBlockingSpace:
 | 
			
		||||
		r.nonBlockingSpace(w, node)
 | 
			
		||||
		r.NonBlockingSpace(w, node)
 | 
			
		||||
	case *ast.Emph:
 | 
			
		||||
		r.outOneOf(w, entering, "<em>", "</em>")
 | 
			
		||||
		r.OutOneOf(w, entering, "<em>", "</em>")
 | 
			
		||||
	case *ast.Strong:
 | 
			
		||||
		r.outOneOf(w, entering, "<strong>", "</strong>")
 | 
			
		||||
		r.OutOneOf(w, entering, "<strong>", "</strong>")
 | 
			
		||||
	case *ast.Del:
 | 
			
		||||
		r.outOneOf(w, entering, "<del>", "</del>")
 | 
			
		||||
		r.OutOneOf(w, entering, "<del>", "</del>")
 | 
			
		||||
	case *ast.BlockQuote:
 | 
			
		||||
		tag := tagWithAttributes("<blockquote", BlockAttrs(node))
 | 
			
		||||
		r.outOneOfCr(w, entering, tag, "</blockquote>")
 | 
			
		||||
		tag := TagWithAttributes("<blockquote", BlockAttrs(node))
 | 
			
		||||
		r.OutOneOfCr(w, entering, tag, "</blockquote>")
 | 
			
		||||
	case *ast.Aside:
 | 
			
		||||
		tag := tagWithAttributes("<aside", BlockAttrs(node))
 | 
			
		||||
		r.outOneOfCr(w, entering, tag, "</aside>")
 | 
			
		||||
		tag := TagWithAttributes("<aside", BlockAttrs(node))
 | 
			
		||||
		r.OutOneOfCr(w, entering, tag, "</aside>")
 | 
			
		||||
	case *ast.Link:
 | 
			
		||||
		r.link(w, node, entering)
 | 
			
		||||
		r.Link(w, node, entering)
 | 
			
		||||
	case *ast.CrossReference:
 | 
			
		||||
		link := &ast.Link{Destination: append([]byte("#"), node.Destination...)}
 | 
			
		||||
		r.link(w, link, entering)
 | 
			
		||||
		r.Link(w, link, entering)
 | 
			
		||||
	case *ast.Citation:
 | 
			
		||||
		r.citation(w, node)
 | 
			
		||||
		r.Citation(w, node)
 | 
			
		||||
	case *ast.Image:
 | 
			
		||||
		if r.opts.Flags&SkipImages != 0 {
 | 
			
		||||
			return ast.SkipChildren
 | 
			
		||||
		}
 | 
			
		||||
		r.image(w, node, entering)
 | 
			
		||||
		r.Image(w, node, entering)
 | 
			
		||||
	case *ast.Code:
 | 
			
		||||
		r.code(w, node)
 | 
			
		||||
		r.Code(w, node)
 | 
			
		||||
	case *ast.CodeBlock:
 | 
			
		||||
		r.codeBlock(w, node)
 | 
			
		||||
		r.CodeBlock(w, node)
 | 
			
		||||
	case *ast.Caption:
 | 
			
		||||
		r.caption(w, node, entering)
 | 
			
		||||
		r.Caption(w, node, entering)
 | 
			
		||||
	case *ast.CaptionFigure:
 | 
			
		||||
		r.captionFigure(w, node, entering)
 | 
			
		||||
		r.CaptionFigure(w, node, entering)
 | 
			
		||||
	case *ast.Document:
 | 
			
		||||
		// do nothing
 | 
			
		||||
	case *ast.Paragraph:
 | 
			
		||||
		r.paragraph(w, node, entering)
 | 
			
		||||
		r.Paragraph(w, node, entering)
 | 
			
		||||
	case *ast.HTMLSpan:
 | 
			
		||||
		r.htmlSpan(w, node)
 | 
			
		||||
		r.HTMLSpan(w, node)
 | 
			
		||||
	case *ast.HTMLBlock:
 | 
			
		||||
		r.htmlBlock(w, node)
 | 
			
		||||
		r.HTMLBlock(w, node)
 | 
			
		||||
	case *ast.Heading:
 | 
			
		||||
		r.heading(w, node, entering)
 | 
			
		||||
		r.Heading(w, node, entering)
 | 
			
		||||
	case *ast.HorizontalRule:
 | 
			
		||||
		r.horizontalRule(w, node)
 | 
			
		||||
		r.HorizontalRule(w, node)
 | 
			
		||||
	case *ast.List:
 | 
			
		||||
		r.list(w, node, entering)
 | 
			
		||||
		r.List(w, node, entering)
 | 
			
		||||
	case *ast.ListItem:
 | 
			
		||||
		r.listItem(w, node, entering)
 | 
			
		||||
		r.ListItem(w, node, entering)
 | 
			
		||||
	case *ast.Table:
 | 
			
		||||
		tag := tagWithAttributes("<table", BlockAttrs(node))
 | 
			
		||||
		r.outOneOfCr(w, entering, tag, "</table>")
 | 
			
		||||
		tag := TagWithAttributes("<table", BlockAttrs(node))
 | 
			
		||||
		r.OutOneOfCr(w, entering, tag, "</table>")
 | 
			
		||||
	case *ast.TableCell:
 | 
			
		||||
		r.tableCell(w, node, entering)
 | 
			
		||||
		r.TableCell(w, node, entering)
 | 
			
		||||
	case *ast.TableHeader:
 | 
			
		||||
		r.outOneOfCr(w, entering, "<thead>", "</thead>")
 | 
			
		||||
		r.OutOneOfCr(w, entering, "<thead>", "</thead>")
 | 
			
		||||
	case *ast.TableBody:
 | 
			
		||||
		r.tableBody(w, node, entering)
 | 
			
		||||
		r.TableBody(w, node, entering)
 | 
			
		||||
	case *ast.TableRow:
 | 
			
		||||
		r.outOneOfCr(w, entering, "<tr>", "</tr>")
 | 
			
		||||
		r.OutOneOfCr(w, entering, "<tr>", "</tr>")
 | 
			
		||||
	case *ast.TableFooter:
 | 
			
		||||
		r.outOneOfCr(w, entering, "<tfoot>", "</tfoot>")
 | 
			
		||||
		r.OutOneOfCr(w, entering, "<tfoot>", "</tfoot>")
 | 
			
		||||
	case *ast.Math:
 | 
			
		||||
		r.outOneOf(w, true, `<span class="math inline">\(`, `\)</span>`)
 | 
			
		||||
		r.OutOneOf(w, true, `<span class="math inline">\(`, `\)</span>`)
 | 
			
		||||
		EscapeHTML(w, node.Literal)
 | 
			
		||||
		r.outOneOf(w, false, `<span class="math inline">\(`, `\)</span>`)
 | 
			
		||||
		r.OutOneOf(w, false, `<span class="math inline">\(`, `\)</span>`)
 | 
			
		||||
	case *ast.MathBlock:
 | 
			
		||||
		r.outOneOf(w, entering, `<p><span class="math display">\[`, `\]</span></p>`)
 | 
			
		||||
		r.OutOneOf(w, entering, `<p><span class="math display">\[`, `\]</span></p>`)
 | 
			
		||||
		if entering {
 | 
			
		||||
			EscapeHTML(w, node.Literal)
 | 
			
		||||
		}
 | 
			
		||||
	case *ast.DocumentMatter:
 | 
			
		||||
		r.matter(w, node, entering)
 | 
			
		||||
		r.DocumentMatter(w, node, entering)
 | 
			
		||||
	case *ast.Callout:
 | 
			
		||||
		r.callout(w, node)
 | 
			
		||||
		r.Callout(w, node)
 | 
			
		||||
	case *ast.Index:
 | 
			
		||||
		r.index(w, node)
 | 
			
		||||
		r.Index(w, node)
 | 
			
		||||
	case *ast.Subscript:
 | 
			
		||||
		r.outOneOf(w, true, "<sub>", "</sub>")
 | 
			
		||||
		r.OutOneOf(w, true, "<sub>", "</sub>")
 | 
			
		||||
		if entering {
 | 
			
		||||
			Escape(w, node.Literal)
 | 
			
		||||
		}
 | 
			
		||||
		r.outOneOf(w, false, "<sub>", "</sub>")
 | 
			
		||||
		r.OutOneOf(w, false, "<sub>", "</sub>")
 | 
			
		||||
	case *ast.Superscript:
 | 
			
		||||
		r.outOneOf(w, true, "<sup>", "</sup>")
 | 
			
		||||
		r.OutOneOf(w, true, "<sup>", "</sup>")
 | 
			
		||||
		if entering {
 | 
			
		||||
			Escape(w, node.Literal)
 | 
			
		||||
		}
 | 
			
		||||
		r.outOneOf(w, false, "<sup>", "</sup>")
 | 
			
		||||
		r.OutOneOf(w, false, "<sup>", "</sup>")
 | 
			
		||||
	case *ast.Footnotes:
 | 
			
		||||
		// nothing by default; just output the list.
 | 
			
		||||
	default:
 | 
			
		||||
@@ -1041,7 +1151,7 @@ func (r *Renderer) RenderHeader(w io.Writer, ast ast.Node) {
 | 
			
		||||
// RenderFooter writes HTML document footer.
 | 
			
		||||
func (r *Renderer) RenderFooter(w io.Writer, _ ast.Node) {
 | 
			
		||||
	if r.documentMatter != ast.DocumentMatterNone {
 | 
			
		||||
		r.outs(w, "</section>\n")
 | 
			
		||||
		r.Outs(w, "</section>\n")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if r.opts.Flags&CompletePage == 0 {
 | 
			
		||||
@@ -1315,7 +1425,8 @@ func BlockAttrs(node ast.Node) []string {
 | 
			
		||||
	return s
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func tagWithAttributes(name string, attrs []string) string {
 | 
			
		||||
// TagWithAttributes creates a HTML tag with a given name and attributes
 | 
			
		||||
func TagWithAttributes(name string, attrs []string) string {
 | 
			
		||||
	s := name
 | 
			
		||||
	if len(attrs) > 0 {
 | 
			
		||||
		s += " " + strings.Join(attrs, " ")
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										20
									
								
								vendor/github.com/gomarkdown/markdown/parser/block.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								vendor/github.com/gomarkdown/markdown/parser/block.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1074,10 +1074,14 @@ func isBackslashEscaped(data []byte, i int) bool {
 | 
			
		||||
func (p *Parser) tableHeader(data []byte) (size int, columns []ast.CellAlignFlags, table ast.Node) {
 | 
			
		||||
	i := 0
 | 
			
		||||
	colCount := 1
 | 
			
		||||
	headerIsUnderline := true
 | 
			
		||||
	for i = 0; i < len(data) && data[i] != '\n'; i++ {
 | 
			
		||||
		if data[i] == '|' && !isBackslashEscaped(data, i) {
 | 
			
		||||
			colCount++
 | 
			
		||||
		}
 | 
			
		||||
		if data[i] != '-' && data[i] != ' ' && data[i] != ':' && data[i] != '|' {
 | 
			
		||||
			headerIsUnderline = false
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// doesn't look like a table header
 | 
			
		||||
@@ -1097,10 +1101,18 @@ func (p *Parser) tableHeader(data []byte) (size int, columns []ast.CellAlignFlag
 | 
			
		||||
		colCount--
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// if the header looks like a underline, then we omit the header
 | 
			
		||||
	// and parse the first line again as underline
 | 
			
		||||
	if headerIsUnderline {
 | 
			
		||||
		header = nil
 | 
			
		||||
		i = 0
 | 
			
		||||
	} else {
 | 
			
		||||
		i++ // move past newline
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	columns = make([]ast.CellAlignFlags, colCount)
 | 
			
		||||
 | 
			
		||||
	// move on to the header underline
 | 
			
		||||
	i++
 | 
			
		||||
	if i >= len(data) {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
@@ -1175,8 +1187,10 @@ func (p *Parser) tableHeader(data []byte) (size int, columns []ast.CellAlignFlag
 | 
			
		||||
 | 
			
		||||
	table = &ast.Table{}
 | 
			
		||||
	p.addBlock(table)
 | 
			
		||||
	p.addBlock(&ast.TableHeader{})
 | 
			
		||||
	p.tableRow(header, columns, true)
 | 
			
		||||
	if header != nil {
 | 
			
		||||
		p.addBlock(&ast.TableHeader{})
 | 
			
		||||
		p.tableRow(header, columns, true)
 | 
			
		||||
	}
 | 
			
		||||
	size = skipCharN(data, i, '\n', 1)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								vendor/github.com/matterbridge/discordgo/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/matterbridge/discordgo/.travis.yml
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -4,6 +4,7 @@ go:
 | 
			
		||||
    - 1.12.x
 | 
			
		||||
    - 1.13.x
 | 
			
		||||
    - 1.14.x
 | 
			
		||||
    - 1.15.x
 | 
			
		||||
env:
 | 
			
		||||
    - GO111MODULE=on
 | 
			
		||||
install:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								vendor/github.com/matterbridge/discordgo/endpoints.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/github.com/matterbridge/discordgo/endpoints.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -112,6 +112,8 @@ var (
 | 
			
		||||
	EndpointChannelMessagesBulkDelete = func(cID string) string { return EndpointChannel(cID) + "/messages/bulk-delete" }
 | 
			
		||||
	EndpointChannelMessagesPins       = func(cID string) string { return EndpointChannel(cID) + "/pins" }
 | 
			
		||||
	EndpointChannelMessagePin         = func(cID, mID string) string { return EndpointChannel(cID) + "/pins/" + mID }
 | 
			
		||||
	EndpointChannelMessageCrosspost   = func(cID, mID string) string { return EndpointChannel(cID) + "/messages/" + mID + "/crosspost" }
 | 
			
		||||
	EndpointChannelFollow             = func(cID string) string { return EndpointChannel(cID) + "/followers" }
 | 
			
		||||
 | 
			
		||||
	EndpointGroupIcon = func(cID, hash string) string { return EndpointCDNChannelIcons + cID + "/" + hash + ".png" }
 | 
			
		||||
 | 
			
		||||
@@ -139,8 +141,8 @@ var (
 | 
			
		||||
 | 
			
		||||
	EndpointIntegrationsJoin = func(iID string) string { return EndpointAPI + "integrations/" + iID + "/join" }
 | 
			
		||||
 | 
			
		||||
	EndpointEmoji         = func(eID string) string { return EndpointAPI + "emojis/" + eID + ".png" }
 | 
			
		||||
	EndpointEmojiAnimated = func(eID string) string { return EndpointAPI + "emojis/" + eID + ".gif" }
 | 
			
		||||
	EndpointEmoji         = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".png" }
 | 
			
		||||
	EndpointEmojiAnimated = func(eID string) string { return EndpointCDN + "emojis/" + eID + ".gif" }
 | 
			
		||||
 | 
			
		||||
	EndpointOauth2            = EndpointAPI + "oauth2/"
 | 
			
		||||
	EndpointApplications      = EndpointOauth2 + "applications"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/matterbridge/discordgo/events.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/matterbridge/discordgo/events.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -252,6 +252,8 @@ type VoiceServerUpdate struct {
 | 
			
		||||
// VoiceStateUpdate is the data for a VoiceStateUpdate event.
 | 
			
		||||
type VoiceStateUpdate struct {
 | 
			
		||||
	*VoiceState
 | 
			
		||||
	// BeforeUpdate will be nil if the VoiceState was not previously cached in the state cache.
 | 
			
		||||
	BeforeUpdate *VoiceState `json:"-"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// MessageDeleteBulk is the data for a MessageDeleteBulk event
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								vendor/github.com/matterbridge/discordgo/message.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/matterbridge/discordgo/message.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -150,6 +150,7 @@ type MessageSend struct {
 | 
			
		||||
	TTS             bool                    `json:"tts"`
 | 
			
		||||
	Files           []*File                 `json:"-"`
 | 
			
		||||
	AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"`
 | 
			
		||||
	Reference       *MessageReference       `json:"message_reference,omitempty"`
 | 
			
		||||
 | 
			
		||||
	// TODO: Remove this when compatibility is not required.
 | 
			
		||||
	File *File `json:"-"`
 | 
			
		||||
@@ -371,6 +372,15 @@ type MessageReference struct {
 | 
			
		||||
	GuildID   string `json:"guild_id"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Reference returns MessageReference of given message
 | 
			
		||||
func (m *Message) Reference() *MessageReference {
 | 
			
		||||
	return &MessageReference{
 | 
			
		||||
		GuildID:   m.GuildID,
 | 
			
		||||
		ChannelID: m.ChannelID,
 | 
			
		||||
		MessageID: m.ID,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ContentWithMentionsReplaced will replace all @<id> mentions with the
 | 
			
		||||
// username of the mention.
 | 
			
		||||
func (m *Message) ContentWithMentionsReplaced() (content string) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										94
									
								
								vendor/github.com/matterbridge/discordgo/restapi.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										94
									
								
								vendor/github.com/matterbridge/discordgo/restapi.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -502,14 +502,12 @@ func (s *Session) UserChannelPermissions(userID, channelID string) (apermissions
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return memberPermissions(guild, channel, member), nil
 | 
			
		||||
	return memberPermissions(guild, channel, userID, member.Roles), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Calculates the permissions for a member.
 | 
			
		||||
// https://support.discord.com/hc/en-us/articles/206141927-How-is-the-permission-hierarchy-structured-
 | 
			
		||||
func memberPermissions(guild *Guild, channel *Channel, member *Member) (apermissions int) {
 | 
			
		||||
	userID := member.User.ID
 | 
			
		||||
 | 
			
		||||
func memberPermissions(guild *Guild, channel *Channel, userID string, roles []string) (apermissions int) {
 | 
			
		||||
	if userID == guild.OwnerID {
 | 
			
		||||
		apermissions = PermissionAll
 | 
			
		||||
		return
 | 
			
		||||
@@ -523,7 +521,7 @@ func memberPermissions(guild *Guild, channel *Channel, member *Member) (apermiss
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, role := range guild.Roles {
 | 
			
		||||
		for _, roleID := range member.Roles {
 | 
			
		||||
		for _, roleID := range roles {
 | 
			
		||||
			if role.ID == roleID {
 | 
			
		||||
				apermissions |= role.Permissions
 | 
			
		||||
				break
 | 
			
		||||
@@ -549,7 +547,7 @@ func memberPermissions(guild *Guild, channel *Channel, member *Member) (apermiss
 | 
			
		||||
 | 
			
		||||
	// Member overwrites can override role overrides, so do two passes
 | 
			
		||||
	for _, overwrite := range channel.PermissionOverwrites {
 | 
			
		||||
		for _, roleID := range member.Roles {
 | 
			
		||||
		for _, roleID := range roles {
 | 
			
		||||
			if overwrite.Type == "role" && roleID == overwrite.ID {
 | 
			
		||||
				denies |= overwrite.Deny
 | 
			
		||||
				allows |= overwrite.Allow
 | 
			
		||||
@@ -834,10 +832,6 @@ func (s *Session) GuildMemberEdit(guildID, userID string, roles []string) (err e
 | 
			
		||||
	}{roles}
 | 
			
		||||
 | 
			
		||||
	_, err = s.RequestWithBucketID("PATCH", EndpointGuildMember(guildID, userID), data, EndpointGuildMember(guildID, ""))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -848,16 +842,11 @@ func (s *Session) GuildMemberEdit(guildID, userID string, roles []string) (err e
 | 
			
		||||
// NOTE : I am not entirely set on the name of this function and it may change
 | 
			
		||||
// prior to the final 1.0.0 release of Discordgo
 | 
			
		||||
func (s *Session) GuildMemberMove(guildID string, userID string, channelID *string) (err error) {
 | 
			
		||||
 | 
			
		||||
	data := struct {
 | 
			
		||||
		ChannelID *string `json:"channel_id"`
 | 
			
		||||
	}{channelID}
 | 
			
		||||
 | 
			
		||||
	_, err = s.RequestWithBucketID("PATCH", EndpointGuildMember(guildID, userID), data, EndpointGuildMember(guildID, ""))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -865,6 +854,7 @@ func (s *Session) GuildMemberMove(guildID string, userID string, channelID *stri
 | 
			
		||||
// guildID   : The ID of a guild
 | 
			
		||||
// userID    : The ID of a user
 | 
			
		||||
// userID    : The ID of a user or "@me" which is a shortcut of the current user ID
 | 
			
		||||
// nickname  : The nickname of the member, "" will reset their nickname
 | 
			
		||||
func (s *Session) GuildMemberNickname(guildID, userID, nickname string) (err error) {
 | 
			
		||||
 | 
			
		||||
	data := struct {
 | 
			
		||||
@@ -879,6 +869,32 @@ func (s *Session) GuildMemberNickname(guildID, userID, nickname string) (err err
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GuildMemberMute server mutes a guild member
 | 
			
		||||
//  guildID   : The ID of a Guild.
 | 
			
		||||
//  userID    : The ID of a User.
 | 
			
		||||
//  mute    : boolean value for if the user should be muted
 | 
			
		||||
func (s *Session) GuildMemberMute(guildID string, userID string, mute bool) (err error) {
 | 
			
		||||
	data := struct {
 | 
			
		||||
		Mute bool `json:"mute"`
 | 
			
		||||
	}{mute}
 | 
			
		||||
 | 
			
		||||
	_, err = s.RequestWithBucketID("PATCH", EndpointGuildMember(guildID, userID), data, EndpointGuildMember(guildID, ""))
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GuildMemberDeafen server deafens a guild member
 | 
			
		||||
//  guildID   : The ID of a Guild.
 | 
			
		||||
//  userID    : The ID of a User.
 | 
			
		||||
//  deaf    : boolean value for if the user should be deafened
 | 
			
		||||
func (s *Session) GuildMemberDeafen(guildID string, userID string, deaf bool) (err error) {
 | 
			
		||||
	data := struct {
 | 
			
		||||
		Deaf bool `json:"deaf"`
 | 
			
		||||
	}{deaf}
 | 
			
		||||
 | 
			
		||||
	_, err = s.RequestWithBucketID("PATCH", EndpointGuildMember(guildID, userID), data, EndpointGuildMember(guildID, ""))
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GuildMemberRoleAdd adds the specified role to a given member
 | 
			
		||||
//  guildID   : The ID of a Guild.
 | 
			
		||||
//  userID    : The ID of a User.
 | 
			
		||||
@@ -1613,6 +1629,17 @@ func (s *Session) ChannelMessageSendEmbed(channelID string, embed *MessageEmbed)
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ChannelMessageSendReply sends a message to the given channel with reference data.
 | 
			
		||||
// channelID : The ID of a Channel.
 | 
			
		||||
// content   : The message to send.
 | 
			
		||||
// reference : The message reference to send.
 | 
			
		||||
func (s *Session) ChannelMessageSendReply(channelID string, content string, reference *MessageReference) (*Message, error) {
 | 
			
		||||
	return s.ChannelMessageSendComplex(channelID, &MessageSend{
 | 
			
		||||
		Content:   content,
 | 
			
		||||
		Reference: reference,
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ChannelMessageEdit edits an existing message, replacing it entirely with
 | 
			
		||||
// the given content.
 | 
			
		||||
// channelID  : The ID of a Channel
 | 
			
		||||
@@ -1790,6 +1817,43 @@ func (s *Session) ChannelPermissionDelete(channelID, targetID string) (err error
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ChannelMessageCrosspost cross posts a message in a news channel to followers
 | 
			
		||||
// of the channel
 | 
			
		||||
// channelID   : The ID of a Channel
 | 
			
		||||
// messageID   : The ID of a Message
 | 
			
		||||
func (s *Session) ChannelMessageCrosspost(channelID, messageID string) (st *Message, err error) {
 | 
			
		||||
 | 
			
		||||
	endpoint := EndpointChannelMessageCrosspost(channelID, messageID)
 | 
			
		||||
 | 
			
		||||
	body, err := s.RequestWithBucketID("POST", endpoint, nil, endpoint)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err = unmarshal(body, &st)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ChannelNewsFollow follows a news channel in the targetID
 | 
			
		||||
// channelID   : The ID of a News Channel
 | 
			
		||||
// targetID    : The ID of a Channel where the News Channel should post to
 | 
			
		||||
func (s *Session) ChannelNewsFollow(channelID, targetID string) (st *ChannelFollow, err error) {
 | 
			
		||||
 | 
			
		||||
	endpoint := EndpointChannelFollow(channelID)
 | 
			
		||||
 | 
			
		||||
	data := struct {
 | 
			
		||||
		WebhookChannelID string `json:"webhook_channel_id"`
 | 
			
		||||
	}{targetID}
 | 
			
		||||
 | 
			
		||||
	body, err := s.RequestWithBucketID("POST", endpoint, data, endpoint)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	err = unmarshal(body, &st)
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ------------------------------------------------------------------------------------------------
 | 
			
		||||
// Functions specific to Discord Invites
 | 
			
		||||
// ------------------------------------------------------------------------------------------------
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										99
									
								
								vendor/github.com/matterbridge/discordgo/state.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										99
									
								
								vendor/github.com/matterbridge/discordgo/state.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -25,6 +25,11 @@ var ErrNilState = errors.New("state not instantiated, please use discordgo.New()
 | 
			
		||||
// requested is not found
 | 
			
		||||
var ErrStateNotFound = errors.New("state cache not found")
 | 
			
		||||
 | 
			
		||||
// ErrMessageIncompletePermissions is returned when the message
 | 
			
		||||
// requested for permissions does not contain enough data to
 | 
			
		||||
// generate the permissions.
 | 
			
		||||
var ErrMessageIncompletePermissions = errors.New("message incomplete, unable to determine permissions")
 | 
			
		||||
 | 
			
		||||
// A State contains the current known state.
 | 
			
		||||
// As discord sends this in a READY blob, it seems reasonable to simply
 | 
			
		||||
// use that struct as the data store.
 | 
			
		||||
@@ -727,6 +732,26 @@ func (s *State) voiceStateUpdate(update *VoiceStateUpdate) error {
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// VoiceState gets a VoiceState by guild and user ID.
 | 
			
		||||
func (s *State) VoiceState(guildID, userID string) (*VoiceState, error) {
 | 
			
		||||
	if s == nil {
 | 
			
		||||
		return nil, ErrNilState
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	guild, err := s.Guild(guildID)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, state := range guild.VoiceStates {
 | 
			
		||||
		if state.UserID == userID {
 | 
			
		||||
			return state, nil
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil, ErrStateNotFound
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Message gets a message by channel and message ID.
 | 
			
		||||
func (s *State) Message(channelID, messageID string) (*Message, error) {
 | 
			
		||||
	if s == nil {
 | 
			
		||||
@@ -916,6 +941,13 @@ func (s *State) OnInterface(se *Session, i interface{}) (err error) {
 | 
			
		||||
		}
 | 
			
		||||
	case *VoiceStateUpdate:
 | 
			
		||||
		if s.TrackVoice {
 | 
			
		||||
			var old *VoiceState
 | 
			
		||||
			old, err = s.VoiceState(t.GuildID, t.UserID)
 | 
			
		||||
			if err == nil {
 | 
			
		||||
				oldCopy := *old
 | 
			
		||||
				t.BeforeUpdate = &oldCopy
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			err = s.voiceStateUpdate(t)
 | 
			
		||||
		}
 | 
			
		||||
	case *PresenceUpdate:
 | 
			
		||||
@@ -980,17 +1012,36 @@ func (s *State) UserChannelPermissions(userID, channelID string) (apermissions i
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if userID == guild.OwnerID {
 | 
			
		||||
		apermissions = PermissionAll
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	member, err := s.Member(guild.ID, userID)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return memberPermissions(guild, channel, member), nil
 | 
			
		||||
	return memberPermissions(guild, channel, userID, member.Roles), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// MessagePermissions returns the permissions of the author of the message
 | 
			
		||||
// in the channel in which it was sent.
 | 
			
		||||
func (s *State) MessagePermissions(message *Message) (apermissions int, err error) {
 | 
			
		||||
	if s == nil {
 | 
			
		||||
		return 0, ErrNilState
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if message.Author == nil || message.Member == nil {
 | 
			
		||||
		return 0, ErrMessageIncompletePermissions
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	channel, err := s.Channel(message.ChannelID)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	guild, err := s.Guild(channel.GuildID)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return memberPermissions(guild, channel, message.Author.ID, message.Member.Roles), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UserColor returns the color of a user in a channel.
 | 
			
		||||
@@ -1018,11 +1069,39 @@ func (s *State) UserColor(userID, channelID string) int {
 | 
			
		||||
		return 0
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return firstRoleColorColor(guild, member.Roles)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// MessageColor returns the color of the author's name as displayed
 | 
			
		||||
// in the client associated with this message.
 | 
			
		||||
func (s *State) MessageColor(message *Message) int {
 | 
			
		||||
	if s == nil {
 | 
			
		||||
		return 0
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if message.Member == nil || message.Member.Roles == nil {
 | 
			
		||||
		return 0
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	channel, err := s.Channel(message.ChannelID)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	guild, err := s.Guild(channel.GuildID)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return 0
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return firstRoleColorColor(guild, message.Member.Roles)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func firstRoleColorColor(guild *Guild, memberRoles []string) int {
 | 
			
		||||
	roles := Roles(guild.Roles)
 | 
			
		||||
	sort.Sort(roles)
 | 
			
		||||
 | 
			
		||||
	for _, role := range roles {
 | 
			
		||||
		for _, roleID := range member.Roles {
 | 
			
		||||
		for _, roleID := range memberRoles {
 | 
			
		||||
			if role.ID == roleID {
 | 
			
		||||
				if role.Color != 0 {
 | 
			
		||||
					return role.Color
 | 
			
		||||
@@ -1031,5 +1110,11 @@ func (s *State) UserColor(userID, channelID string) int {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for _, role := range roles {
 | 
			
		||||
		if role.ID == guild.ID {
 | 
			
		||||
			return role.Color
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 0
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								vendor/github.com/matterbridge/discordgo/structs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								vendor/github.com/matterbridge/discordgo/structs.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -316,6 +316,12 @@ type ChannelEdit struct {
 | 
			
		||||
	RateLimitPerUser     int                    `json:"rate_limit_per_user,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// A ChannelFollow holds data returned after following a news channel
 | 
			
		||||
type ChannelFollow struct {
 | 
			
		||||
	ChannelID string `json:"channel_id"`
 | 
			
		||||
	WebhookID string `json:"webhook_id"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// A PermissionOverwrite holds permission overwrite data for a Channel
 | 
			
		||||
type PermissionOverwrite struct {
 | 
			
		||||
	ID    string `json:"id"`
 | 
			
		||||
@@ -614,6 +620,7 @@ type GuildParams struct {
 | 
			
		||||
	Icon                        string             `json:"icon,omitempty"`
 | 
			
		||||
	OwnerID                     string             `json:"owner_id,omitempty"`
 | 
			
		||||
	Splash                      string             `json:"splash,omitempty"`
 | 
			
		||||
	Banner                      string             `json:"banner,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// A Role stores information about Discord guild member roles.
 | 
			
		||||
@@ -1057,6 +1064,9 @@ type Webhook struct {
 | 
			
		||||
	Name      string      `json:"name"`
 | 
			
		||||
	Avatar    string      `json:"avatar"`
 | 
			
		||||
	Token     string      `json:"token"`
 | 
			
		||||
 | 
			
		||||
	// ApplicationID is the bot/OAuth2 application that created this webhook
 | 
			
		||||
	ApplicationID string `json:"application_id,omitempty"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// WebhookType is the type of Webhook (see WebhookType* consts) in the Webhook struct
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										37
									
								
								vendor/github.com/matterbridge/discordgo/user.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										37
									
								
								vendor/github.com/matterbridge/discordgo/user.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -2,6 +2,27 @@ package discordgo
 | 
			
		||||
 | 
			
		||||
import "strings"
 | 
			
		||||
 | 
			
		||||
// UserFlags is the flags of "user" (see UserFlags* consts)
 | 
			
		||||
// https://discord.com/developers/docs/resources/user#user-object-user-flags
 | 
			
		||||
type UserFlags int
 | 
			
		||||
 | 
			
		||||
// Valid UserFlags values
 | 
			
		||||
const (
 | 
			
		||||
	UserFlagDiscordEmployee      UserFlags = 1 << 0
 | 
			
		||||
	UserFlagDiscordPartner                 = 1 << 1
 | 
			
		||||
	UserFlagHypeSquadEvents                = 1 << 2
 | 
			
		||||
	UserFlagBugHunterLevel1                = 1 << 3
 | 
			
		||||
	UserFlagHouseBravery                   = 1 << 6
 | 
			
		||||
	UserFlagHouseBrilliance                = 1 << 7
 | 
			
		||||
	UserFlagHouseBalance                   = 1 << 8
 | 
			
		||||
	UserFlagEarlySupporter                 = 1 << 9
 | 
			
		||||
	UserFlagTeamUser                       = 1 << 10
 | 
			
		||||
	UserFlagSystem                         = 1 << 12
 | 
			
		||||
	UserFlagBugHunterLevel2                = 1 << 14
 | 
			
		||||
	UserFlagVerifiedBot                    = 1 << 16
 | 
			
		||||
	UserFlagVerifiedBotDeveloper           = 1 << 17
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// A User stores all data for an individual Discord user.
 | 
			
		||||
type User struct {
 | 
			
		||||
	// The ID of the user.
 | 
			
		||||
@@ -36,6 +57,22 @@ type User struct {
 | 
			
		||||
 | 
			
		||||
	// Whether the user is a bot.
 | 
			
		||||
	Bot bool `json:"bot"`
 | 
			
		||||
 | 
			
		||||
	// The public flags on a user's account.
 | 
			
		||||
	// This is a combination of bit masks; the presence of a certain flag can
 | 
			
		||||
	// be checked by performing a bitwise AND between this int and the flag.
 | 
			
		||||
	PublicFlags UserFlags `json:"public_flags"`
 | 
			
		||||
 | 
			
		||||
	// The type of Nitro subscription on a user's account.
 | 
			
		||||
	// Only available when the request is authorized via a Bearer token.
 | 
			
		||||
	PremiumType int `json:"premium_type"`
 | 
			
		||||
 | 
			
		||||
	// Whether the user is an Official Discord System user (part of the urgent message system).
 | 
			
		||||
	System bool `json:"system"`
 | 
			
		||||
 | 
			
		||||
	// The flags on a user's account.
 | 
			
		||||
	// Only available when the request is authorized via a Bearer token.
 | 
			
		||||
	Flags int `json:"flags"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// String returns a unique identifier of the form username#discriminator
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/github.com/matterbridge/discordgo/voice.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/matterbridge/discordgo/voice.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -139,6 +139,7 @@ func (v *VoiceConnection) ChangeChannel(channelID string, mute, deaf bool) (err
 | 
			
		||||
func (v *VoiceConnection) Disconnect() (err error) {
 | 
			
		||||
 | 
			
		||||
	// Send a OP4 with a nil channel to disconnect
 | 
			
		||||
	v.Lock()
 | 
			
		||||
	if v.sessionID != "" {
 | 
			
		||||
		data := voiceChannelJoinOp{4, voiceChannelJoinData{&v.GuildID, nil, true, true}}
 | 
			
		||||
		v.session.wsMutex.Lock()
 | 
			
		||||
@@ -146,6 +147,7 @@ func (v *VoiceConnection) Disconnect() (err error) {
 | 
			
		||||
		v.session.wsMutex.Unlock()
 | 
			
		||||
		v.sessionID = ""
 | 
			
		||||
	}
 | 
			
		||||
	v.Unlock()
 | 
			
		||||
 | 
			
		||||
	// Close websocket and udp connections
 | 
			
		||||
	v.Close()
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								vendor/github.com/mattermost/mattermost-server/v5/model/channel_sidebar.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								vendor/github.com/mattermost/mattermost-server/v5/model/channel_sidebar.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -6,6 +6,7 @@ package model
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"io"
 | 
			
		||||
	"regexp"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type SidebarCategoryType string
 | 
			
		||||
@@ -109,3 +110,15 @@ func (o OrderedSidebarCategories) ToJson() []byte {
 | 
			
		||||
		return b
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var categoryIdPattern = regexp.MustCompile("(favorites|channels|direct_messages)_[a-z0-9]{26}_[a-z0-9]{26}")
 | 
			
		||||
 | 
			
		||||
func IsValidCategoryId(s string) bool {
 | 
			
		||||
	// Category IDs can either be regular IDs
 | 
			
		||||
	if IsValidId(s) {
 | 
			
		||||
		return true
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Or default categories can follow the pattern {type}_{userID}_{teamID}
 | 
			
		||||
	return categoryIdPattern.MatchString(s)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								vendor/github.com/mattermost/mattermost-server/v5/model/config.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								vendor/github.com/mattermost/mattermost-server/v5/model/config.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -342,6 +342,9 @@ type ServiceSettings struct {
 | 
			
		||||
	EnableAPIChannelDeletion                          *bool
 | 
			
		||||
	EnableLocalMode                                   *bool
 | 
			
		||||
	LocalModeSocketLocation                           *string
 | 
			
		||||
	EnableAWSMetering                                 *bool
 | 
			
		||||
	ThreadAutoFollow                                  *bool   `access:"experimental"`
 | 
			
		||||
	ManagedResourcePaths                              *string `access:"environment,write_restrictable,cloud_restrictable"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (s *ServiceSettings) SetDefaults(isUpdate bool) {
 | 
			
		||||
@@ -755,6 +758,18 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
 | 
			
		||||
	if s.LocalModeSocketLocation == nil {
 | 
			
		||||
		s.LocalModeSocketLocation = NewString(LOCAL_MODE_SOCKET_PATH)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if s.EnableAWSMetering == nil {
 | 
			
		||||
		s.EnableAWSMetering = NewBool(false)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if s.ThreadAutoFollow == nil {
 | 
			
		||||
		s.ThreadAutoFollow = NewBool(true)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if s.ManagedResourcePaths == nil {
 | 
			
		||||
		s.ManagedResourcePaths = NewString("")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type ClusterSettings struct {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										33
									
								
								vendor/github.com/mattermost/mattermost-server/v5/model/file_info.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										33
									
								
								vendor/github.com/mattermost/mattermost-server/v5/model/file_info.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -36,22 +36,23 @@ type GetFileInfosOptions struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type FileInfo struct {
 | 
			
		||||
	Id              string `json:"id"`
 | 
			
		||||
	CreatorId       string `json:"user_id"`
 | 
			
		||||
	PostId          string `json:"post_id,omitempty"`
 | 
			
		||||
	CreateAt        int64  `json:"create_at"`
 | 
			
		||||
	UpdateAt        int64  `json:"update_at"`
 | 
			
		||||
	DeleteAt        int64  `json:"delete_at"`
 | 
			
		||||
	Path            string `json:"-"` // not sent back to the client
 | 
			
		||||
	ThumbnailPath   string `json:"-"` // not sent back to the client
 | 
			
		||||
	PreviewPath     string `json:"-"` // not sent back to the client
 | 
			
		||||
	Name            string `json:"name"`
 | 
			
		||||
	Extension       string `json:"extension"`
 | 
			
		||||
	Size            int64  `json:"size"`
 | 
			
		||||
	MimeType        string `json:"mime_type"`
 | 
			
		||||
	Width           int    `json:"width,omitempty"`
 | 
			
		||||
	Height          int    `json:"height,omitempty"`
 | 
			
		||||
	HasPreviewImage bool   `json:"has_preview_image,omitempty"`
 | 
			
		||||
	Id              string  `json:"id"`
 | 
			
		||||
	CreatorId       string  `json:"user_id"`
 | 
			
		||||
	PostId          string  `json:"post_id,omitempty"`
 | 
			
		||||
	CreateAt        int64   `json:"create_at"`
 | 
			
		||||
	UpdateAt        int64   `json:"update_at"`
 | 
			
		||||
	DeleteAt        int64   `json:"delete_at"`
 | 
			
		||||
	Path            string  `json:"-"` // not sent back to the client
 | 
			
		||||
	ThumbnailPath   string  `json:"-"` // not sent back to the client
 | 
			
		||||
	PreviewPath     string  `json:"-"` // not sent back to the client
 | 
			
		||||
	Name            string  `json:"name"`
 | 
			
		||||
	Extension       string  `json:"extension"`
 | 
			
		||||
	Size            int64   `json:"size"`
 | 
			
		||||
	MimeType        string  `json:"mime_type"`
 | 
			
		||||
	Width           int     `json:"width,omitempty"`
 | 
			
		||||
	Height          int     `json:"height,omitempty"`
 | 
			
		||||
	HasPreviewImage bool    `json:"has_preview_image,omitempty"`
 | 
			
		||||
	MiniPreview     *[]byte `json:"mini_preview"` // declared as *[]byte to avoid postgres/mysql differences in deserialization
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (fi *FileInfo) ToJson() string {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										38
									
								
								vendor/github.com/mattermost/mattermost-server/v5/model/thread.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								vendor/github.com/mattermost/mattermost-server/v5/model/thread.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
 | 
			
		||||
// See LICENSE.txt for license information.
 | 
			
		||||
 | 
			
		||||
package model
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Thread struct {
 | 
			
		||||
	PostId       string      `json:"id"`
 | 
			
		||||
	ChannelId    string      `json:"channel_id"`
 | 
			
		||||
	ReplyCount   int64       `json:"reply_count"`
 | 
			
		||||
	LastReplyAt  int64       `json:"last_reply_at"`
 | 
			
		||||
	Participants StringArray `json:"participants"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (o *Thread) ToJson() string {
 | 
			
		||||
	b, _ := json.Marshal(o)
 | 
			
		||||
	return string(b)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (o *Thread) Etag() string {
 | 
			
		||||
	return Etag(o.PostId, o.LastReplyAt)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type ThreadMembership struct {
 | 
			
		||||
	PostId      string `json:"post_id"`
 | 
			
		||||
	UserId      string `json:"user_id"`
 | 
			
		||||
	Following   bool   `json:"following"`
 | 
			
		||||
	LastViewed  int64  `json:"last_view_at"`
 | 
			
		||||
	LastUpdated int64  `json:"last_update_at"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (o *ThreadMembership) ToJson() string {
 | 
			
		||||
	b, _ := json.Marshal(o)
 | 
			
		||||
	return string(b)
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										20
									
								
								vendor/github.com/mattermost/mattermost-server/v5/model/utils.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								vendor/github.com/mattermost/mattermost-server/v5/model/utils.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -36,6 +36,26 @@ type StringInterface map[string]interface{}
 | 
			
		||||
type StringMap map[string]string
 | 
			
		||||
type StringArray []string
 | 
			
		||||
 | 
			
		||||
func (sa StringArray) Remove(input string) StringArray {
 | 
			
		||||
	for index := range sa {
 | 
			
		||||
		if sa[index] == input {
 | 
			
		||||
			ret := make(StringArray, 0, len(sa)-1)
 | 
			
		||||
			ret = append(ret, sa[:index]...)
 | 
			
		||||
			return append(ret, sa[index+1:]...)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return sa
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (sa StringArray) Contains(input string) bool {
 | 
			
		||||
	for index := range sa {
 | 
			
		||||
		if sa[index] == input {
 | 
			
		||||
			return true
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return false
 | 
			
		||||
}
 | 
			
		||||
func (sa StringArray) Equals(input StringArray) bool {
 | 
			
		||||
 | 
			
		||||
	if len(sa) != len(input) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								vendor/github.com/mattermost/mattermost-server/v5/model/version.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/mattermost/mattermost-server/v5/model/version.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -13,6 +13,7 @@ import (
 | 
			
		||||
// It should be maintained in chronological order with most current
 | 
			
		||||
// release at the front of the list.
 | 
			
		||||
var versions = []string{
 | 
			
		||||
	"5.29.0",
 | 
			
		||||
	"5.28.0",
 | 
			
		||||
	"5.27.0",
 | 
			
		||||
	"5.26.0",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										38
									
								
								vendor/github.com/mattn/godown/godown.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										38
									
								
								vendor/github.com/mattn/godown/godown.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -346,6 +346,22 @@ func walk(node *html.Node, w io.Writer, nest int, option *Option) {
 | 
			
		||||
					fmt.Fprint(w, "\n\n")
 | 
			
		||||
				}
 | 
			
		||||
			default:
 | 
			
		||||
				if option == nil || option.CustomRules == nil {
 | 
			
		||||
					walk(c, w, nest, option)
 | 
			
		||||
					break
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				foundCustom := false
 | 
			
		||||
				for _, cr := range option.CustomRules {
 | 
			
		||||
					if tag, customWalk := cr.Rule(walk); strings.ToLower(c.Data) == tag {
 | 
			
		||||
						customWalk(c, w, nest, option)
 | 
			
		||||
						foundCustom = true
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				if foundCustom {
 | 
			
		||||
					break
 | 
			
		||||
				}
 | 
			
		||||
				walk(c, w, nest, option)
 | 
			
		||||
			}
 | 
			
		||||
		default:
 | 
			
		||||
@@ -354,11 +370,27 @@ func walk(node *html.Node, w io.Writer, nest int, option *Option) {
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// WalkFunc type is an signature for functions traversing HTML nodes
 | 
			
		||||
type WalkFunc func(node *html.Node, w io.Writer, nest int, option *Option)
 | 
			
		||||
 | 
			
		||||
// CustomRule is an interface to define custom conversion rules
 | 
			
		||||
//
 | 
			
		||||
// Rule method accepts `next WalkFunc` as an argument, which `customRule` should call
 | 
			
		||||
// to let walk function continue parsing the content inside the HTML tag.
 | 
			
		||||
// It returns a tagName to indicate what HTML element this `customRule` handles and the `customRule`
 | 
			
		||||
// function itself, where conversion logic should reside.
 | 
			
		||||
//
 | 
			
		||||
// See example TestRule implementation in godown_test.go
 | 
			
		||||
type CustomRule interface {
 | 
			
		||||
	Rule(next WalkFunc) (tagName string, customRule WalkFunc)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Option is optional information for Convert.
 | 
			
		||||
type Option struct {
 | 
			
		||||
	GuessLang func(string) (string, error)
 | 
			
		||||
	Script    bool
 | 
			
		||||
	Style     bool
 | 
			
		||||
	GuessLang   func(string) (string, error)
 | 
			
		||||
	Script      bool
 | 
			
		||||
	Style       bool
 | 
			
		||||
	CustomRules []CustomRule
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Convert convert HTML to Markdown. Read HTML from r and write to w.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										517
									
								
								vendor/github.com/missdeer/golib/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										517
									
								
								vendor/github.com/missdeer/golib/LICENSE
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,21 +1,504 @@
 | 
			
		||||
MIT License
 | 
			
		||||
                  GNU LESSER GENERAL PUBLIC LICENSE
 | 
			
		||||
                       Version 2.1, February 1999
 | 
			
		||||
 | 
			
		||||
Copyright (c) 2017 DForD Software
 | 
			
		||||
 Copyright (C) 1991, 1999 Free Software Foundation, Inc.
 | 
			
		||||
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 | 
			
		||||
 Everyone is permitted to copy and distribute verbatim copies
 | 
			
		||||
 of this license document, but changing it is not allowed.
 | 
			
		||||
 | 
			
		||||
Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
of this software and associated documentation files (the "Software"), to deal
 | 
			
		||||
in the Software without restriction, including without limitation the rights
 | 
			
		||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
			
		||||
copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
furnished to do so, subject to the following conditions:
 | 
			
		||||
[This is the first released version of the Lesser GPL.  It also counts
 | 
			
		||||
 as the successor of the GNU Library Public License, version 2, hence
 | 
			
		||||
 the version number 2.1.]
 | 
			
		||||
 | 
			
		||||
The above copyright notice and this permission notice shall be included in all
 | 
			
		||||
copies or substantial portions of the Software.
 | 
			
		||||
                            Preamble
 | 
			
		||||
 | 
			
		||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
			
		||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
			
		||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
			
		||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 | 
			
		||||
SOFTWARE.
 | 
			
		||||
  The licenses for most software are designed to take away your
 | 
			
		||||
freedom to share and change it.  By contrast, the GNU General Public
 | 
			
		||||
Licenses are intended to guarantee your freedom to share and change
 | 
			
		||||
free software--to make sure the software is free for all its users.
 | 
			
		||||
 | 
			
		||||
  This license, the Lesser General Public License, applies to some
 | 
			
		||||
specially designated software packages--typically libraries--of the
 | 
			
		||||
Free Software Foundation and other authors who decide to use it.  You
 | 
			
		||||
can use it too, but we suggest you first think carefully about whether
 | 
			
		||||
this license or the ordinary General Public License is the better
 | 
			
		||||
strategy to use in any particular case, based on the explanations below.
 | 
			
		||||
 | 
			
		||||
  When we speak of free software, we are referring to freedom of use,
 | 
			
		||||
not price.  Our General Public Licenses are designed to make sure that
 | 
			
		||||
you have the freedom to distribute copies of free software (and charge
 | 
			
		||||
for this service if you wish); that you receive source code or can get
 | 
			
		||||
it if you want it; that you can change the software and use pieces of
 | 
			
		||||
it in new free programs; and that you are informed that you can do
 | 
			
		||||
these things.
 | 
			
		||||
 | 
			
		||||
  To protect your rights, we need to make restrictions that forbid
 | 
			
		||||
distributors to deny you these rights or to ask you to surrender these
 | 
			
		||||
rights.  These restrictions translate to certain responsibilities for
 | 
			
		||||
you if you distribute copies of the library or if you modify it.
 | 
			
		||||
 | 
			
		||||
  For example, if you distribute copies of the library, whether gratis
 | 
			
		||||
or for a fee, you must give the recipients all the rights that we gave
 | 
			
		||||
you.  You must make sure that they, too, receive or can get the source
 | 
			
		||||
code.  If you link other code with the library, you must provide
 | 
			
		||||
complete object files to the recipients, so that they can relink them
 | 
			
		||||
with the library after making changes to the library and recompiling
 | 
			
		||||
it.  And you must show them these terms so they know their rights.
 | 
			
		||||
 | 
			
		||||
  We protect your rights with a two-step method: (1) we copyright the
 | 
			
		||||
library, and (2) we offer you this license, which gives you legal
 | 
			
		||||
permission to copy, distribute and/or modify the library.
 | 
			
		||||
 | 
			
		||||
  To protect each distributor, we want to make it very clear that
 | 
			
		||||
there is no warranty for the free library.  Also, if the library is
 | 
			
		||||
modified by someone else and passed on, the recipients should know
 | 
			
		||||
that what they have is not the original version, so that the original
 | 
			
		||||
author's reputation will not be affected by problems that might be
 | 
			
		||||
introduced by others.
 | 
			
		||||
 | 
			
		||||
  Finally, software patents pose a constant threat to the existence of
 | 
			
		||||
any free program.  We wish to make sure that a company cannot
 | 
			
		||||
effectively restrict the users of a free program by obtaining a
 | 
			
		||||
restrictive license from a patent holder.  Therefore, we insist that
 | 
			
		||||
any patent license obtained for a version of the library must be
 | 
			
		||||
consistent with the full freedom of use specified in this license.
 | 
			
		||||
 | 
			
		||||
  Most GNU software, including some libraries, is covered by the
 | 
			
		||||
ordinary GNU General Public License.  This license, the GNU Lesser
 | 
			
		||||
General Public License, applies to certain designated libraries, and
 | 
			
		||||
is quite different from the ordinary General Public License.  We use
 | 
			
		||||
this license for certain libraries in order to permit linking those
 | 
			
		||||
libraries into non-free programs.
 | 
			
		||||
 | 
			
		||||
  When a program is linked with a library, whether statically or using
 | 
			
		||||
a shared library, the combination of the two is legally speaking a
 | 
			
		||||
combined work, a derivative of the original library.  The ordinary
 | 
			
		||||
General Public License therefore permits such linking only if the
 | 
			
		||||
entire combination fits its criteria of freedom.  The Lesser General
 | 
			
		||||
Public License permits more lax criteria for linking other code with
 | 
			
		||||
the library.
 | 
			
		||||
 | 
			
		||||
  We call this license the "Lesser" General Public License because it
 | 
			
		||||
does Less to protect the user's freedom than the ordinary General
 | 
			
		||||
Public License.  It also provides other free software developers Less
 | 
			
		||||
of an advantage over competing non-free programs.  These disadvantages
 | 
			
		||||
are the reason we use the ordinary General Public License for many
 | 
			
		||||
libraries.  However, the Lesser license provides advantages in certain
 | 
			
		||||
special circumstances.
 | 
			
		||||
 | 
			
		||||
  For example, on rare occasions, there may be a special need to
 | 
			
		||||
encourage the widest possible use of a certain library, so that it becomes
 | 
			
		||||
a de-facto standard.  To achieve this, non-free programs must be
 | 
			
		||||
allowed to use the library.  A more frequent case is that a free
 | 
			
		||||
library does the same job as widely used non-free libraries.  In this
 | 
			
		||||
case, there is little to gain by limiting the free library to free
 | 
			
		||||
software only, so we use the Lesser General Public License.
 | 
			
		||||
 | 
			
		||||
  In other cases, permission to use a particular library in non-free
 | 
			
		||||
programs enables a greater number of people to use a large body of
 | 
			
		||||
free software.  For example, permission to use the GNU C Library in
 | 
			
		||||
non-free programs enables many more people to use the whole GNU
 | 
			
		||||
operating system, as well as its variant, the GNU/Linux operating
 | 
			
		||||
system.
 | 
			
		||||
 | 
			
		||||
  Although the Lesser General Public License is Less protective of the
 | 
			
		||||
users' freedom, it does ensure that the user of a program that is
 | 
			
		||||
linked with the Library has the freedom and the wherewithal to run
 | 
			
		||||
that program using a modified version of the Library.
 | 
			
		||||
 | 
			
		||||
  The precise terms and conditions for copying, distribution and
 | 
			
		||||
modification follow.  Pay close attention to the difference between a
 | 
			
		||||
"work based on the library" and a "work that uses the library".  The
 | 
			
		||||
former contains code derived from the library, whereas the latter must
 | 
			
		||||
be combined with the library in order to run.
 | 
			
		||||
 | 
			
		||||
                  GNU LESSER GENERAL PUBLIC LICENSE
 | 
			
		||||
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 | 
			
		||||
 | 
			
		||||
  0. This License Agreement applies to any software library or other
 | 
			
		||||
program which contains a notice placed by the copyright holder or
 | 
			
		||||
other authorized party saying it may be distributed under the terms of
 | 
			
		||||
this Lesser General Public License (also called "this License").
 | 
			
		||||
Each licensee is addressed as "you".
 | 
			
		||||
 | 
			
		||||
  A "library" means a collection of software functions and/or data
 | 
			
		||||
prepared so as to be conveniently linked with application programs
 | 
			
		||||
(which use some of those functions and data) to form executables.
 | 
			
		||||
 | 
			
		||||
  The "Library", below, refers to any such software library or work
 | 
			
		||||
which has been distributed under these terms.  A "work based on the
 | 
			
		||||
Library" means either the Library or any derivative work under
 | 
			
		||||
copyright law: that is to say, a work containing the Library or a
 | 
			
		||||
portion of it, either verbatim or with modifications and/or translated
 | 
			
		||||
straightforwardly into another language.  (Hereinafter, translation is
 | 
			
		||||
included without limitation in the term "modification".)
 | 
			
		||||
 | 
			
		||||
  "Source code" for a work means the preferred form of the work for
 | 
			
		||||
making modifications to it.  For a library, complete source code means
 | 
			
		||||
all the source code for all modules it contains, plus any associated
 | 
			
		||||
interface definition files, plus the scripts used to control compilation
 | 
			
		||||
and installation of the library.
 | 
			
		||||
 | 
			
		||||
  Activities other than copying, distribution and modification are not
 | 
			
		||||
covered by this License; they are outside its scope.  The act of
 | 
			
		||||
running a program using the Library is not restricted, and output from
 | 
			
		||||
such a program is covered only if its contents constitute a work based
 | 
			
		||||
on the Library (independent of the use of the Library in a tool for
 | 
			
		||||
writing it).  Whether that is true depends on what the Library does
 | 
			
		||||
and what the program that uses the Library does.
 | 
			
		||||
 | 
			
		||||
  1. You may copy and distribute verbatim copies of the Library's
 | 
			
		||||
complete source code as you receive it, in any medium, provided that
 | 
			
		||||
you conspicuously and appropriately publish on each copy an
 | 
			
		||||
appropriate copyright notice and disclaimer of warranty; keep intact
 | 
			
		||||
all the notices that refer to this License and to the absence of any
 | 
			
		||||
warranty; and distribute a copy of this License along with the
 | 
			
		||||
Library.
 | 
			
		||||
 | 
			
		||||
  You may charge a fee for the physical act of transferring a copy,
 | 
			
		||||
and you may at your option offer warranty protection in exchange for a
 | 
			
		||||
fee.
 | 
			
		||||
 | 
			
		||||
  2. You may modify your copy or copies of the Library or any portion
 | 
			
		||||
of it, thus forming a work based on the Library, and copy and
 | 
			
		||||
distribute such modifications or work under the terms of Section 1
 | 
			
		||||
above, provided that you also meet all of these conditions:
 | 
			
		||||
 | 
			
		||||
    a) The modified work must itself be a software library.
 | 
			
		||||
 | 
			
		||||
    b) You must cause the files modified to carry prominent notices
 | 
			
		||||
    stating that you changed the files and the date of any change.
 | 
			
		||||
 | 
			
		||||
    c) You must cause the whole of the work to be licensed at no
 | 
			
		||||
    charge to all third parties under the terms of this License.
 | 
			
		||||
 | 
			
		||||
    d) If a facility in the modified Library refers to a function or a
 | 
			
		||||
    table of data to be supplied by an application program that uses
 | 
			
		||||
    the facility, other than as an argument passed when the facility
 | 
			
		||||
    is invoked, then you must make a good faith effort to ensure that,
 | 
			
		||||
    in the event an application does not supply such function or
 | 
			
		||||
    table, the facility still operates, and performs whatever part of
 | 
			
		||||
    its purpose remains meaningful.
 | 
			
		||||
 | 
			
		||||
    (For example, a function in a library to compute square roots has
 | 
			
		||||
    a purpose that is entirely well-defined independent of the
 | 
			
		||||
    application.  Therefore, Subsection 2d requires that any
 | 
			
		||||
    application-supplied function or table used by this function must
 | 
			
		||||
    be optional: if the application does not supply it, the square
 | 
			
		||||
    root function must still compute square roots.)
 | 
			
		||||
 | 
			
		||||
These requirements apply to the modified work as a whole.  If
 | 
			
		||||
identifiable sections of that work are not derived from the Library,
 | 
			
		||||
and can be reasonably considered independent and separate works in
 | 
			
		||||
themselves, then this License, and its terms, do not apply to those
 | 
			
		||||
sections when you distribute them as separate works.  But when you
 | 
			
		||||
distribute the same sections as part of a whole which is a work based
 | 
			
		||||
on the Library, the distribution of the whole must be on the terms of
 | 
			
		||||
this License, whose permissions for other licensees extend to the
 | 
			
		||||
entire whole, and thus to each and every part regardless of who wrote
 | 
			
		||||
it.
 | 
			
		||||
 | 
			
		||||
Thus, it is not the intent of this section to claim rights or contest
 | 
			
		||||
your rights to work written entirely by you; rather, the intent is to
 | 
			
		||||
exercise the right to control the distribution of derivative or
 | 
			
		||||
collective works based on the Library.
 | 
			
		||||
 | 
			
		||||
In addition, mere aggregation of another work not based on the Library
 | 
			
		||||
with the Library (or with a work based on the Library) on a volume of
 | 
			
		||||
a storage or distribution medium does not bring the other work under
 | 
			
		||||
the scope of this License.
 | 
			
		||||
 | 
			
		||||
  3. You may opt to apply the terms of the ordinary GNU General Public
 | 
			
		||||
License instead of this License to a given copy of the Library.  To do
 | 
			
		||||
this, you must alter all the notices that refer to this License, so
 | 
			
		||||
that they refer to the ordinary GNU General Public License, version 2,
 | 
			
		||||
instead of to this License.  (If a newer version than version 2 of the
 | 
			
		||||
ordinary GNU General Public License has appeared, then you can specify
 | 
			
		||||
that version instead if you wish.)  Do not make any other change in
 | 
			
		||||
these notices.
 | 
			
		||||
 | 
			
		||||
  Once this change is made in a given copy, it is irreversible for
 | 
			
		||||
that copy, so the ordinary GNU General Public License applies to all
 | 
			
		||||
subsequent copies and derivative works made from that copy.
 | 
			
		||||
 | 
			
		||||
  This option is useful when you wish to copy part of the code of
 | 
			
		||||
the Library into a program that is not a library.
 | 
			
		||||
 | 
			
		||||
  4. You may copy and distribute the Library (or a portion or
 | 
			
		||||
derivative of it, under Section 2) in object code or executable form
 | 
			
		||||
under the terms of Sections 1 and 2 above provided that you accompany
 | 
			
		||||
it with the complete corresponding machine-readable source code, which
 | 
			
		||||
must be distributed under the terms of Sections 1 and 2 above on a
 | 
			
		||||
medium customarily used for software interchange.
 | 
			
		||||
 | 
			
		||||
  If distribution of object code is made by offering access to copy
 | 
			
		||||
from a designated place, then offering equivalent access to copy the
 | 
			
		||||
source code from the same place satisfies the requirement to
 | 
			
		||||
distribute the source code, even though third parties are not
 | 
			
		||||
compelled to copy the source along with the object code.
 | 
			
		||||
 | 
			
		||||
  5. A program that contains no derivative of any portion of the
 | 
			
		||||
Library, but is designed to work with the Library by being compiled or
 | 
			
		||||
linked with it, is called a "work that uses the Library".  Such a
 | 
			
		||||
work, in isolation, is not a derivative work of the Library, and
 | 
			
		||||
therefore falls outside the scope of this License.
 | 
			
		||||
 | 
			
		||||
  However, linking a "work that uses the Library" with the Library
 | 
			
		||||
creates an executable that is a derivative of the Library (because it
 | 
			
		||||
contains portions of the Library), rather than a "work that uses the
 | 
			
		||||
library".  The executable is therefore covered by this License.
 | 
			
		||||
Section 6 states terms for distribution of such executables.
 | 
			
		||||
 | 
			
		||||
  When a "work that uses the Library" uses material from a header file
 | 
			
		||||
that is part of the Library, the object code for the work may be a
 | 
			
		||||
derivative work of the Library even though the source code is not.
 | 
			
		||||
Whether this is true is especially significant if the work can be
 | 
			
		||||
linked without the Library, or if the work is itself a library.  The
 | 
			
		||||
threshold for this to be true is not precisely defined by law.
 | 
			
		||||
 | 
			
		||||
  If such an object file uses only numerical parameters, data
 | 
			
		||||
structure layouts and accessors, and small macros and small inline
 | 
			
		||||
functions (ten lines or less in length), then the use of the object
 | 
			
		||||
file is unrestricted, regardless of whether it is legally a derivative
 | 
			
		||||
work.  (Executables containing this object code plus portions of the
 | 
			
		||||
Library will still fall under Section 6.)
 | 
			
		||||
 | 
			
		||||
  Otherwise, if the work is a derivative of the Library, you may
 | 
			
		||||
distribute the object code for the work under the terms of Section 6.
 | 
			
		||||
Any executables containing that work also fall under Section 6,
 | 
			
		||||
whether or not they are linked directly with the Library itself.
 | 
			
		||||
 | 
			
		||||
  6. As an exception to the Sections above, you may also combine or
 | 
			
		||||
link a "work that uses the Library" with the Library to produce a
 | 
			
		||||
work containing portions of the Library, and distribute that work
 | 
			
		||||
under terms of your choice, provided that the terms permit
 | 
			
		||||
modification of the work for the customer's own use and reverse
 | 
			
		||||
engineering for debugging such modifications.
 | 
			
		||||
 | 
			
		||||
  You must give prominent notice with each copy of the work that the
 | 
			
		||||
Library is used in it and that the Library and its use are covered by
 | 
			
		||||
this License.  You must supply a copy of this License.  If the work
 | 
			
		||||
during execution displays copyright notices, you must include the
 | 
			
		||||
copyright notice for the Library among them, as well as a reference
 | 
			
		||||
directing the user to the copy of this License.  Also, you must do one
 | 
			
		||||
of these things:
 | 
			
		||||
 | 
			
		||||
    a) Accompany the work with the complete corresponding
 | 
			
		||||
    machine-readable source code for the Library including whatever
 | 
			
		||||
    changes were used in the work (which must be distributed under
 | 
			
		||||
    Sections 1 and 2 above); and, if the work is an executable linked
 | 
			
		||||
    with the Library, with the complete machine-readable "work that
 | 
			
		||||
    uses the Library", as object code and/or source code, so that the
 | 
			
		||||
    user can modify the Library and then relink to produce a modified
 | 
			
		||||
    executable containing the modified Library.  (It is understood
 | 
			
		||||
    that the user who changes the contents of definitions files in the
 | 
			
		||||
    Library will not necessarily be able to recompile the application
 | 
			
		||||
    to use the modified definitions.)
 | 
			
		||||
 | 
			
		||||
    b) Use a suitable shared library mechanism for linking with the
 | 
			
		||||
    Library.  A suitable mechanism is one that (1) uses at run time a
 | 
			
		||||
    copy of the library already present on the user's computer system,
 | 
			
		||||
    rather than copying library functions into the executable, and (2)
 | 
			
		||||
    will operate properly with a modified version of the library, if
 | 
			
		||||
    the user installs one, as long as the modified version is
 | 
			
		||||
    interface-compatible with the version that the work was made with.
 | 
			
		||||
 | 
			
		||||
    c) Accompany the work with a written offer, valid for at
 | 
			
		||||
    least three years, to give the same user the materials
 | 
			
		||||
    specified in Subsection 6a, above, for a charge no more
 | 
			
		||||
    than the cost of performing this distribution.
 | 
			
		||||
 | 
			
		||||
    d) If distribution of the work is made by offering access to copy
 | 
			
		||||
    from a designated place, offer equivalent access to copy the above
 | 
			
		||||
    specified materials from the same place.
 | 
			
		||||
 | 
			
		||||
    e) Verify that the user has already received a copy of these
 | 
			
		||||
    materials or that you have already sent this user a copy.
 | 
			
		||||
 | 
			
		||||
  For an executable, the required form of the "work that uses the
 | 
			
		||||
Library" must include any data and utility programs needed for
 | 
			
		||||
reproducing the executable from it.  However, as a special exception,
 | 
			
		||||
the materials to be distributed need not include anything that is
 | 
			
		||||
normally distributed (in either source or binary form) with the major
 | 
			
		||||
components (compiler, kernel, and so on) of the operating system on
 | 
			
		||||
which the executable runs, unless that component itself accompanies
 | 
			
		||||
the executable.
 | 
			
		||||
 | 
			
		||||
  It may happen that this requirement contradicts the license
 | 
			
		||||
restrictions of other proprietary libraries that do not normally
 | 
			
		||||
accompany the operating system.  Such a contradiction means you cannot
 | 
			
		||||
use both them and the Library together in an executable that you
 | 
			
		||||
distribute.
 | 
			
		||||
 | 
			
		||||
  7. You may place library facilities that are a work based on the
 | 
			
		||||
Library side-by-side in a single library together with other library
 | 
			
		||||
facilities not covered by this License, and distribute such a combined
 | 
			
		||||
library, provided that the separate distribution of the work based on
 | 
			
		||||
the Library and of the other library facilities is otherwise
 | 
			
		||||
permitted, and provided that you do these two things:
 | 
			
		||||
 | 
			
		||||
    a) Accompany the combined library with a copy of the same work
 | 
			
		||||
    based on the Library, uncombined with any other library
 | 
			
		||||
    facilities.  This must be distributed under the terms of the
 | 
			
		||||
    Sections above.
 | 
			
		||||
 | 
			
		||||
    b) Give prominent notice with the combined library of the fact
 | 
			
		||||
    that part of it is a work based on the Library, and explaining
 | 
			
		||||
    where to find the accompanying uncombined form of the same work.
 | 
			
		||||
 | 
			
		||||
  8. You may not copy, modify, sublicense, link with, or distribute
 | 
			
		||||
the Library except as expressly provided under this License.  Any
 | 
			
		||||
attempt otherwise to copy, modify, sublicense, link with, or
 | 
			
		||||
distribute the Library is void, and will automatically terminate your
 | 
			
		||||
rights under this License.  However, parties who have received copies,
 | 
			
		||||
or rights, from you under this License will not have their licenses
 | 
			
		||||
terminated so long as such parties remain in full compliance.
 | 
			
		||||
 | 
			
		||||
  9. You are not required to accept this License, since you have not
 | 
			
		||||
signed it.  However, nothing else grants you permission to modify or
 | 
			
		||||
distribute the Library or its derivative works.  These actions are
 | 
			
		||||
prohibited by law if you do not accept this License.  Therefore, by
 | 
			
		||||
modifying or distributing the Library (or any work based on the
 | 
			
		||||
Library), you indicate your acceptance of this License to do so, and
 | 
			
		||||
all its terms and conditions for copying, distributing or modifying
 | 
			
		||||
the Library or works based on it.
 | 
			
		||||
 | 
			
		||||
  10. Each time you redistribute the Library (or any work based on the
 | 
			
		||||
Library), the recipient automatically receives a license from the
 | 
			
		||||
original licensor to copy, distribute, link with or modify the Library
 | 
			
		||||
subject to these terms and conditions.  You may not impose any further
 | 
			
		||||
restrictions on the recipients' exercise of the rights granted herein.
 | 
			
		||||
You are not responsible for enforcing compliance by third parties with
 | 
			
		||||
this License.
 | 
			
		||||
 | 
			
		||||
  11. If, as a consequence of a court judgment or allegation of patent
 | 
			
		||||
infringement or for any other reason (not limited to patent issues),
 | 
			
		||||
conditions are imposed on you (whether by court order, agreement or
 | 
			
		||||
otherwise) that contradict the conditions of this License, they do not
 | 
			
		||||
excuse you from the conditions of this License.  If you cannot
 | 
			
		||||
distribute so as to satisfy simultaneously your obligations under this
 | 
			
		||||
License and any other pertinent obligations, then as a consequence you
 | 
			
		||||
may not distribute the Library at all.  For example, if a patent
 | 
			
		||||
license would not permit royalty-free redistribution of the Library by
 | 
			
		||||
all those who receive copies directly or indirectly through you, then
 | 
			
		||||
the only way you could satisfy both it and this License would be to
 | 
			
		||||
refrain entirely from distribution of the Library.
 | 
			
		||||
 | 
			
		||||
If any portion of this section is held invalid or unenforceable under any
 | 
			
		||||
particular circumstance, the balance of the section is intended to apply,
 | 
			
		||||
and the section as a whole is intended to apply in other circumstances.
 | 
			
		||||
 | 
			
		||||
It is not the purpose of this section to induce you to infringe any
 | 
			
		||||
patents or other property right claims or to contest validity of any
 | 
			
		||||
such claims; this section has the sole purpose of protecting the
 | 
			
		||||
integrity of the free software distribution system which is
 | 
			
		||||
implemented by public license practices.  Many people have made
 | 
			
		||||
generous contributions to the wide range of software distributed
 | 
			
		||||
through that system in reliance on consistent application of that
 | 
			
		||||
system; it is up to the author/donor to decide if he or she is willing
 | 
			
		||||
to distribute software through any other system and a licensee cannot
 | 
			
		||||
impose that choice.
 | 
			
		||||
 | 
			
		||||
This section is intended to make thoroughly clear what is believed to
 | 
			
		||||
be a consequence of the rest of this License.
 | 
			
		||||
 | 
			
		||||
  12. If the distribution and/or use of the Library is restricted in
 | 
			
		||||
certain countries either by patents or by copyrighted interfaces, the
 | 
			
		||||
original copyright holder who places the Library under this License may add
 | 
			
		||||
an explicit geographical distribution limitation excluding those countries,
 | 
			
		||||
so that distribution is permitted only in or among countries not thus
 | 
			
		||||
excluded.  In such case, this License incorporates the limitation as if
 | 
			
		||||
written in the body of this License.
 | 
			
		||||
 | 
			
		||||
  13. The Free Software Foundation may publish revised and/or new
 | 
			
		||||
versions of the Lesser General Public License from time to time.
 | 
			
		||||
Such new versions will be similar in spirit to the present version,
 | 
			
		||||
but may differ in detail to address new problems or concerns.
 | 
			
		||||
 | 
			
		||||
Each version is given a distinguishing version number.  If the Library
 | 
			
		||||
specifies a version number of this License which applies to it and
 | 
			
		||||
"any later version", you have the option of following the terms and
 | 
			
		||||
conditions either of that version or of any later version published by
 | 
			
		||||
the Free Software Foundation.  If the Library does not specify a
 | 
			
		||||
license version number, you may choose any version ever published by
 | 
			
		||||
the Free Software Foundation.
 | 
			
		||||
 | 
			
		||||
  14. If you wish to incorporate parts of the Library into other free
 | 
			
		||||
programs whose distribution conditions are incompatible with these,
 | 
			
		||||
write to the author to ask for permission.  For software which is
 | 
			
		||||
copyrighted by the Free Software Foundation, write to the Free
 | 
			
		||||
Software Foundation; we sometimes make exceptions for this.  Our
 | 
			
		||||
decision will be guided by the two goals of preserving the free status
 | 
			
		||||
of all derivatives of our free software and of promoting the sharing
 | 
			
		||||
and reuse of software generally.
 | 
			
		||||
 | 
			
		||||
                            NO WARRANTY
 | 
			
		||||
 | 
			
		||||
  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
 | 
			
		||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
 | 
			
		||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
 | 
			
		||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
 | 
			
		||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
 | 
			
		||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 | 
			
		||||
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
 | 
			
		||||
LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
 | 
			
		||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
 | 
			
		||||
 | 
			
		||||
  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
 | 
			
		||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
 | 
			
		||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
 | 
			
		||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
 | 
			
		||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
 | 
			
		||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
 | 
			
		||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
 | 
			
		||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
 | 
			
		||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
 | 
			
		||||
DAMAGES.
 | 
			
		||||
 | 
			
		||||
                     END OF TERMS AND CONDITIONS
 | 
			
		||||
 | 
			
		||||
           How to Apply These Terms to Your New Libraries
 | 
			
		||||
 | 
			
		||||
  If you develop a new library, and you want it to be of the greatest
 | 
			
		||||
possible use to the public, we recommend making it free software that
 | 
			
		||||
everyone can redistribute and change.  You can do so by permitting
 | 
			
		||||
redistribution under these terms (or, alternatively, under the terms of the
 | 
			
		||||
ordinary General Public License).
 | 
			
		||||
 | 
			
		||||
  To apply these terms, attach the following notices to the library.  It is
 | 
			
		||||
safest to attach them to the start of each source file to most effectively
 | 
			
		||||
convey the exclusion of warranty; and each file should have at least the
 | 
			
		||||
"copyright" line and a pointer to where the full notice is found.
 | 
			
		||||
 | 
			
		||||
    <one line to give the library's name and a brief idea of what it does.>
 | 
			
		||||
    Copyright (C) <year>  <name of author>
 | 
			
		||||
 | 
			
		||||
    This library is free software; you can redistribute it and/or
 | 
			
		||||
    modify it under the terms of the GNU Lesser General Public
 | 
			
		||||
    License as published by the Free Software Foundation; either
 | 
			
		||||
    version 2.1 of the License, or (at your option) any later version.
 | 
			
		||||
 | 
			
		||||
    This library is distributed in the hope that it will be useful,
 | 
			
		||||
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
			
		||||
    Lesser General Public License for more details.
 | 
			
		||||
 | 
			
		||||
    You should have received a copy of the GNU Lesser General Public
 | 
			
		||||
    License along with this library; if not, write to the Free Software
 | 
			
		||||
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
 | 
			
		||||
    USA
 | 
			
		||||
 | 
			
		||||
Also add information on how to contact you by electronic and paper mail.
 | 
			
		||||
 | 
			
		||||
You should also get your employer (if you work as a programmer) or your
 | 
			
		||||
school, if any, to sign a "copyright disclaimer" for the library, if
 | 
			
		||||
necessary.  Here is a sample; alter the names:
 | 
			
		||||
 | 
			
		||||
  Yoyodyne, Inc., hereby disclaims all copyright interest in the
 | 
			
		||||
  library `Frob' (a library for tweaking knobs) written by James Random
 | 
			
		||||
  Hacker.
 | 
			
		||||
 | 
			
		||||
  <signature of Ty Coon>, 1 April 1990
 | 
			
		||||
  Ty Coon, President of Vice
 | 
			
		||||
 | 
			
		||||
That's all there is to it!
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								vendor/github.com/shazow/rateio/limiter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								vendor/github.com/shazow/rateio/limiter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -7,7 +7,7 @@ import (
 | 
			
		||||
 | 
			
		||||
const minInt = -int(^uint(0)>>1) - 1
 | 
			
		||||
 | 
			
		||||
// The error returned when the read rate exceeds our specification.
 | 
			
		||||
// ErrRateExceeded is the error returned when the read rate exceeds our specification.
 | 
			
		||||
var ErrRateExceeded = errors.New("Read rate exceeded.")
 | 
			
		||||
 | 
			
		||||
// Limiter is an interface for a rate limiter.
 | 
			
		||||
@@ -27,7 +27,7 @@ type simpleLimiter struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewSimpleLimiter creates a Limiter that restricts a given number of bytes per frequency.
 | 
			
		||||
func NewSimpleLimiter(amount int, frequency time.Duration) Limiter {
 | 
			
		||||
func NewSimpleLimiter(amount int, frequency time.Duration) *simpleLimiter {
 | 
			
		||||
	return &simpleLimiter{
 | 
			
		||||
		Amount:    amount,
 | 
			
		||||
		Frequency: frequency,
 | 
			
		||||
@@ -38,7 +38,7 @@ func NewSimpleLimiter(amount int, frequency time.Duration) Limiter {
 | 
			
		||||
// SimpleLimiter but adds a grace period at the start of the rate
 | 
			
		||||
// limiting where it allows unlimited bytes to be read during that
 | 
			
		||||
// period.
 | 
			
		||||
func NewGracefulLimiter(amount int, frequency time.Duration, grace time.Duration) Limiter {
 | 
			
		||||
func NewGracefulLimiter(amount int, frequency time.Duration, grace time.Duration) *simpleLimiter {
 | 
			
		||||
	return &simpleLimiter{
 | 
			
		||||
		Amount:    amount,
 | 
			
		||||
		Frequency: frequency,
 | 
			
		||||
@@ -60,3 +60,12 @@ func (limit *simpleLimiter) Count(n int) error {
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Delay returns a channel that can be used to block until next window
 | 
			
		||||
func (limit *simpleLimiter) Delay() <-chan time.Time {
 | 
			
		||||
	waitTill := time.Now()
 | 
			
		||||
	if limit.numRead >= limit.Amount {
 | 
			
		||||
		waitTill = waitTill.Add(limit.Frequency)
 | 
			
		||||
	}
 | 
			
		||||
	return time.NewTimer(time.Until(waitTill)).C
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										1
									
								
								vendor/github.com/shazow/ssh-chat/sshd/auth.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/github.com/shazow/ssh-chat/sshd/auth.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -19,6 +19,7 @@ type Auth interface {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// MakeAuth makes an ssh.ServerConfig which performs authentication against an Auth implementation.
 | 
			
		||||
// TODO: Switch to using ssh.AuthMethod instead?
 | 
			
		||||
func MakeAuth(auth Auth) *ssh.ServerConfig {
 | 
			
		||||
	config := ssh.ServerConfig{
 | 
			
		||||
		NoClientAuth: false,
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/github.com/shazow/ssh-chat/sshd/pty.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/shazow/ssh-chat/sshd/pty.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -6,8 +6,8 @@ import "encoding/binary"
 | 
			
		||||
 | 
			
		||||
// parsePtyRequest parses the payload of the pty-req message and extracts the
 | 
			
		||||
// dimensions of the terminal. See RFC 4254, section 6.2.
 | 
			
		||||
func parsePtyRequest(s []byte) (width, height int, ok bool) {
 | 
			
		||||
	_, s, ok = parseString(s)
 | 
			
		||||
func parsePtyRequest(s []byte) (term string, width, height int, ok bool) {
 | 
			
		||||
	term, s, ok = parseString(s)
 | 
			
		||||
	if !ok {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										88
									
								
								vendor/github.com/shazow/ssh-chat/sshd/terminal.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										88
									
								
								vendor/github.com/shazow/ssh-chat/sshd/terminal.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -55,6 +55,29 @@ func (c sshConn) Name() string {
 | 
			
		||||
	return c.User()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// EnvVar is an environment variable key-value pair
 | 
			
		||||
type EnvVar struct {
 | 
			
		||||
	Key   string
 | 
			
		||||
	Value string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (v EnvVar) String() string {
 | 
			
		||||
	return v.Key + "=" + v.Value
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Env is a wrapper type around []EnvVar with some helper methods
 | 
			
		||||
type Env []EnvVar
 | 
			
		||||
 | 
			
		||||
// Get returns the latest value for a given key, or empty string if not found
 | 
			
		||||
func (e Env) Get(key string) string {
 | 
			
		||||
	for i := len(e) - 1; i >= 0; i-- {
 | 
			
		||||
		if e[i].Key == key {
 | 
			
		||||
			return e[i].Value
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return ""
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Terminal extends ssh/terminal to include a close method
 | 
			
		||||
type Terminal struct {
 | 
			
		||||
	terminal.Terminal
 | 
			
		||||
@@ -63,9 +86,14 @@ type Terminal struct {
 | 
			
		||||
 | 
			
		||||
	done      chan struct{}
 | 
			
		||||
	closeOnce sync.Once
 | 
			
		||||
 | 
			
		||||
	mu   sync.Mutex
 | 
			
		||||
	env  []EnvVar
 | 
			
		||||
	term string
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Make new terminal from a session channel
 | 
			
		||||
// TODO: For v2, make a separate `Serve(ctx context.Context) error` method to activate the Terminal
 | 
			
		||||
func NewTerminal(conn *ssh.ServerConn, ch ssh.NewChannel) (*Terminal, error) {
 | 
			
		||||
	if ch.ChannelType() != "session" {
 | 
			
		||||
		return nil, ErrNotSessionChannel
 | 
			
		||||
@@ -75,14 +103,15 @@ func NewTerminal(conn *ssh.ServerConn, ch ssh.NewChannel) (*Terminal, error) {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	term := Terminal{
 | 
			
		||||
		Terminal: *terminal.NewTerminal(channel, "Connecting..."),
 | 
			
		||||
		Terminal: *terminal.NewTerminal(channel, ""),
 | 
			
		||||
		Conn:     sshConn{conn},
 | 
			
		||||
		Channel:  channel,
 | 
			
		||||
 | 
			
		||||
		done: make(chan struct{}),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	go term.listen(requests)
 | 
			
		||||
	ready := make(chan struct{})
 | 
			
		||||
	go term.listen(requests, ready)
 | 
			
		||||
 | 
			
		||||
	go func() {
 | 
			
		||||
		// Keep-Alive Ticker
 | 
			
		||||
@@ -103,7 +132,18 @@ func NewTerminal(conn *ssh.ServerConn, ch ssh.NewChannel) (*Terminal, error) {
 | 
			
		||||
		}
 | 
			
		||||
	}()
 | 
			
		||||
 | 
			
		||||
	return &term, nil
 | 
			
		||||
	// We need to wait for term.ready to acquire a shell before we return, this
 | 
			
		||||
	// gives the SSH session a chance to populate the env vars and other state.
 | 
			
		||||
	// TODO: Make the timeout configurable
 | 
			
		||||
	// TODO: Use context.Context for abort/timeout in the future, will need to change the API.
 | 
			
		||||
	select {
 | 
			
		||||
	case <-ready: // shell acquired
 | 
			
		||||
		return &term, nil
 | 
			
		||||
	case <-term.done:
 | 
			
		||||
		return nil, errors.New("terminal aborted")
 | 
			
		||||
	case <-time.NewTimer(time.Minute).C:
 | 
			
		||||
		return nil, errors.New("timed out starting terminal")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewSession Finds a session channel and make a Terminal from it
 | 
			
		||||
@@ -133,8 +173,9 @@ func (t *Terminal) Close() error {
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Negotiate terminal type and settings
 | 
			
		||||
func (t *Terminal) listen(requests <-chan *ssh.Request) {
 | 
			
		||||
// listen negotiates the terminal type and state
 | 
			
		||||
// ready is closed when the terminal is ready.
 | 
			
		||||
func (t *Terminal) listen(requests <-chan *ssh.Request, ready chan<- struct{}) {
 | 
			
		||||
	hasShell := false
 | 
			
		||||
 | 
			
		||||
	for req := range requests {
 | 
			
		||||
@@ -146,13 +187,19 @@ func (t *Terminal) listen(requests <-chan *ssh.Request) {
 | 
			
		||||
			if !hasShell {
 | 
			
		||||
				ok = true
 | 
			
		||||
				hasShell = true
 | 
			
		||||
				close(ready)
 | 
			
		||||
			}
 | 
			
		||||
		case "pty-req":
 | 
			
		||||
			width, height, ok = parsePtyRequest(req.Payload)
 | 
			
		||||
			var term string
 | 
			
		||||
			term, width, height, ok = parsePtyRequest(req.Payload)
 | 
			
		||||
			if ok {
 | 
			
		||||
				// TODO: Hardcode width to 100000?
 | 
			
		||||
				err := t.SetSize(width, height)
 | 
			
		||||
				ok = err == nil
 | 
			
		||||
				// Save the term:
 | 
			
		||||
				t.mu.Lock()
 | 
			
		||||
				t.term = term
 | 
			
		||||
				t.mu.Unlock()
 | 
			
		||||
			}
 | 
			
		||||
		case "window-change":
 | 
			
		||||
			width, height, ok = parseWinchRequest(req.Payload)
 | 
			
		||||
@@ -161,6 +208,14 @@ func (t *Terminal) listen(requests <-chan *ssh.Request) {
 | 
			
		||||
				err := t.SetSize(width, height)
 | 
			
		||||
				ok = err == nil
 | 
			
		||||
			}
 | 
			
		||||
		case "env":
 | 
			
		||||
			var v EnvVar
 | 
			
		||||
			if err := ssh.Unmarshal(req.Payload, &v); err == nil {
 | 
			
		||||
				t.mu.Lock()
 | 
			
		||||
				t.env = append(t.env, v)
 | 
			
		||||
				t.mu.Unlock()
 | 
			
		||||
				ok = true
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if req.WantReply {
 | 
			
		||||
@@ -168,3 +223,24 @@ func (t *Terminal) listen(requests <-chan *ssh.Request) {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Env returns a list of environment key-values that have been set. They are
 | 
			
		||||
// returned in the order that they have been set, there is no deduplication or
 | 
			
		||||
// other pre-processing applied.
 | 
			
		||||
func (t *Terminal) Env() Env {
 | 
			
		||||
	t.mu.Lock()
 | 
			
		||||
	defer t.mu.Unlock()
 | 
			
		||||
	return Env(t.env)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Term returns the terminal string value as set by the pty.
 | 
			
		||||
// If there was no pty request, it falls back to the TERM value passed in as an
 | 
			
		||||
// Env variable.
 | 
			
		||||
func (t *Terminal) Term() string {
 | 
			
		||||
	t.mu.Lock()
 | 
			
		||||
	defer t.mu.Unlock()
 | 
			
		||||
	if t.term != "" {
 | 
			
		||||
		return t.term
 | 
			
		||||
	}
 | 
			
		||||
	return Env(t.env).Get("TERM")
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								vendor/github.com/shazow/ssh-chat/sshd/terminal/terminal.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/github.com/shazow/ssh-chat/sshd/terminal/terminal.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -10,6 +10,8 @@ import (
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"sync"
 | 
			
		||||
	"unicode/utf8"
 | 
			
		||||
 | 
			
		||||
	"golang.org/x/text/width"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// EscapeCodes contains escape sequences that can be written to the terminal in
 | 
			
		||||
@@ -262,7 +264,7 @@ func (t *Terminal) moveCursorToPos(pos int) {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	x := visualLength(t.prompt) + pos
 | 
			
		||||
	x := visualLength(t.prompt) + visualLength(t.line[:pos])
 | 
			
		||||
	y := x / t.termWidth
 | 
			
		||||
	x = x % t.termWidth
 | 
			
		||||
 | 
			
		||||
@@ -351,6 +353,7 @@ func (t *Terminal) setLine(newLine []rune, newPos int) {
 | 
			
		||||
		for i := len(newLine); i < len(t.line); i++ {
 | 
			
		||||
			t.writeLine(space)
 | 
			
		||||
		}
 | 
			
		||||
		t.line = newLine
 | 
			
		||||
		t.moveCursorToPos(newPos)
 | 
			
		||||
	}
 | 
			
		||||
	t.line = newLine
 | 
			
		||||
@@ -462,6 +465,10 @@ func visualLength(runes []rune) int {
 | 
			
		||||
			inEscapeSeq = true
 | 
			
		||||
		default:
 | 
			
		||||
			length++
 | 
			
		||||
			kind := width.LookupRune(r).Kind()
 | 
			
		||||
			if kind == width.EastAsianFullwidth || kind == width.EastAsianWide {
 | 
			
		||||
				length++
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/golang.org/x/crypto/ssh/client_auth.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/golang.org/x/crypto/ssh/client_auth.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -471,7 +471,7 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if len(answers) != len(prompts) {
 | 
			
		||||
			return authFailure, nil, errors.New("ssh: not enough answers from keyboard-interactive callback")
 | 
			
		||||
			return authFailure, nil, fmt.Errorf("ssh: incorrect number of answers from keyboard-interactive callback %d (expected %d)", len(answers), len(prompts))
 | 
			
		||||
		}
 | 
			
		||||
		responseLength := 1 + 4
 | 
			
		||||
		for _, a := range answers {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								vendor/golang.org/x/crypto/ssh/kex.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								vendor/golang.org/x/crypto/ssh/kex.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -557,8 +557,6 @@ type dhGEXSHA struct {
 | 
			
		||||
	hashFunc crypto.Hash
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const numMRTests = 64
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	dhGroupExchangeMinimumBits   = 2048
 | 
			
		||||
	dhGroupExchangePreferredBits = 2048
 | 
			
		||||
@@ -602,15 +600,8 @@ func (gex dhGEXSHA) Client(c packetConn, randSource io.Reader, magics *handshake
 | 
			
		||||
	gex.p = kexDHGexGroup.P
 | 
			
		||||
	gex.g = kexDHGexGroup.G
 | 
			
		||||
 | 
			
		||||
	// Check if p is safe by verifing that p and (p-1)/2 are primes
 | 
			
		||||
	one := big.NewInt(1)
 | 
			
		||||
	var pHalf = &big.Int{}
 | 
			
		||||
	pHalf.Rsh(gex.p, 1)
 | 
			
		||||
	if !gex.p.ProbablyPrime(numMRTests) || !pHalf.ProbablyPrime(numMRTests) {
 | 
			
		||||
		return nil, fmt.Errorf("ssh: server provided gex p is not safe")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Check if g is safe by verifing that g > 1 and g < p - 1
 | 
			
		||||
	one := big.NewInt(1)
 | 
			
		||||
	var pMinusOne = &big.Int{}
 | 
			
		||||
	pMinusOne.Sub(gex.p, one)
 | 
			
		||||
	if gex.g.Cmp(one) != 1 && gex.g.Cmp(pMinusOne) != -1 {
 | 
			
		||||
@@ -618,6 +609,8 @@ func (gex dhGEXSHA) Client(c packetConn, randSource io.Reader, magics *handshake
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Send GexInit
 | 
			
		||||
	var pHalf = &big.Int{}
 | 
			
		||||
	pHalf.Rsh(gex.p, 1)
 | 
			
		||||
	x, err := rand.Int(randSource, pHalf)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										60
									
								
								vendor/golang.org/x/sys/cpu/cpu.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										60
									
								
								vendor/golang.org/x/sys/cpu/cpu.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -29,26 +29,46 @@ type CacheLinePad struct{ _ [cacheLineSize]byte }
 | 
			
		||||
// and HasAVX2 are only set if the OS supports XMM and YMM
 | 
			
		||||
// registers in addition to the CPUID feature bit being set.
 | 
			
		||||
var X86 struct {
 | 
			
		||||
	_            CacheLinePad
 | 
			
		||||
	HasAES       bool // AES hardware implementation (AES NI)
 | 
			
		||||
	HasADX       bool // Multi-precision add-carry instruction extensions
 | 
			
		||||
	HasAVX       bool // Advanced vector extension
 | 
			
		||||
	HasAVX2      bool // Advanced vector extension 2
 | 
			
		||||
	HasBMI1      bool // Bit manipulation instruction set 1
 | 
			
		||||
	HasBMI2      bool // Bit manipulation instruction set 2
 | 
			
		||||
	HasERMS      bool // Enhanced REP for MOVSB and STOSB
 | 
			
		||||
	HasFMA       bool // Fused-multiply-add instructions
 | 
			
		||||
	HasOSXSAVE   bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers.
 | 
			
		||||
	HasPCLMULQDQ bool // PCLMULQDQ instruction - most often used for AES-GCM
 | 
			
		||||
	HasPOPCNT    bool // Hamming weight instruction POPCNT.
 | 
			
		||||
	HasRDRAND    bool // RDRAND instruction (on-chip random number generator)
 | 
			
		||||
	HasRDSEED    bool // RDSEED instruction (on-chip random number generator)
 | 
			
		||||
	HasSSE2      bool // Streaming SIMD extension 2 (always available on amd64)
 | 
			
		||||
	HasSSE3      bool // Streaming SIMD extension 3
 | 
			
		||||
	HasSSSE3     bool // Supplemental streaming SIMD extension 3
 | 
			
		||||
	HasSSE41     bool // Streaming SIMD extension 4 and 4.1
 | 
			
		||||
	HasSSE42     bool // Streaming SIMD extension 4 and 4.2
 | 
			
		||||
	_            CacheLinePad
 | 
			
		||||
	_                   CacheLinePad
 | 
			
		||||
	HasAES              bool // AES hardware implementation (AES NI)
 | 
			
		||||
	HasADX              bool // Multi-precision add-carry instruction extensions
 | 
			
		||||
	HasAVX              bool // Advanced vector extension
 | 
			
		||||
	HasAVX2             bool // Advanced vector extension 2
 | 
			
		||||
	HasAVX512           bool // Advanced vector extension 512
 | 
			
		||||
	HasAVX512F          bool // Advanced vector extension 512 Foundation Instructions
 | 
			
		||||
	HasAVX512CD         bool // Advanced vector extension 512 Conflict Detection Instructions
 | 
			
		||||
	HasAVX512ER         bool // Advanced vector extension 512 Exponential and Reciprocal Instructions
 | 
			
		||||
	HasAVX512PF         bool // Advanced vector extension 512 Prefetch Instructions Instructions
 | 
			
		||||
	HasAVX512VL         bool // Advanced vector extension 512 Vector Length Extensions
 | 
			
		||||
	HasAVX512BW         bool // Advanced vector extension 512 Byte and Word Instructions
 | 
			
		||||
	HasAVX512DQ         bool // Advanced vector extension 512 Doubleword and Quadword Instructions
 | 
			
		||||
	HasAVX512IFMA       bool // Advanced vector extension 512 Integer Fused Multiply Add
 | 
			
		||||
	HasAVX512VBMI       bool // Advanced vector extension 512 Vector Byte Manipulation Instructions
 | 
			
		||||
	HasAVX5124VNNIW     bool // Advanced vector extension 512 Vector Neural Network Instructions Word variable precision
 | 
			
		||||
	HasAVX5124FMAPS     bool // Advanced vector extension 512 Fused Multiply Accumulation Packed Single precision
 | 
			
		||||
	HasAVX512VPOPCNTDQ  bool // Advanced vector extension 512 Double and quad word population count instructions
 | 
			
		||||
	HasAVX512VPCLMULQDQ bool // Advanced vector extension 512 Vector carry-less multiply operations
 | 
			
		||||
	HasAVX512VNNI       bool // Advanced vector extension 512 Vector Neural Network Instructions
 | 
			
		||||
	HasAVX512GFNI       bool // Advanced vector extension 512 Galois field New Instructions
 | 
			
		||||
	HasAVX512VAES       bool // Advanced vector extension 512 Vector AES instructions
 | 
			
		||||
	HasAVX512VBMI2      bool // Advanced vector extension 512 Vector Byte Manipulation Instructions 2
 | 
			
		||||
	HasAVX512BITALG     bool // Advanced vector extension 512 Bit Algorithms
 | 
			
		||||
	HasAVX512BF16       bool // Advanced vector extension 512 BFloat16 Instructions
 | 
			
		||||
	HasBMI1             bool // Bit manipulation instruction set 1
 | 
			
		||||
	HasBMI2             bool // Bit manipulation instruction set 2
 | 
			
		||||
	HasERMS             bool // Enhanced REP for MOVSB and STOSB
 | 
			
		||||
	HasFMA              bool // Fused-multiply-add instructions
 | 
			
		||||
	HasOSXSAVE          bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers.
 | 
			
		||||
	HasPCLMULQDQ        bool // PCLMULQDQ instruction - most often used for AES-GCM
 | 
			
		||||
	HasPOPCNT           bool // Hamming weight instruction POPCNT.
 | 
			
		||||
	HasRDRAND           bool // RDRAND instruction (on-chip random number generator)
 | 
			
		||||
	HasRDSEED           bool // RDSEED instruction (on-chip random number generator)
 | 
			
		||||
	HasSSE2             bool // Streaming SIMD extension 2 (always available on amd64)
 | 
			
		||||
	HasSSE3             bool // Streaming SIMD extension 3
 | 
			
		||||
	HasSSSE3            bool // Supplemental streaming SIMD extension 3
 | 
			
		||||
	HasSSE41            bool // Streaming SIMD extension 4 and 4.1
 | 
			
		||||
	HasSSE42            bool // Streaming SIMD extension 4 and 4.2
 | 
			
		||||
	_                   CacheLinePad
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ARM64 contains the supported CPU features of the
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										39
									
								
								vendor/golang.org/x/sys/cpu/cpu_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										39
									
								
								vendor/golang.org/x/sys/cpu/cpu_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -39,31 +39,34 @@ func initOptions() {
 | 
			
		||||
 | 
			
		||||
func archInit() {
 | 
			
		||||
	switch runtime.GOOS {
 | 
			
		||||
	case "android", "darwin", "netbsd":
 | 
			
		||||
		// Android and iOS don't seem to allow reading these registers.
 | 
			
		||||
		//
 | 
			
		||||
		// NetBSD:
 | 
			
		||||
		// ID_AA64ISAR0_EL1 is a privileged register and cannot be read from EL0.
 | 
			
		||||
		// It can be read via sysctl(3). Example for future implementers:
 | 
			
		||||
		// https://nxr.netbsd.org/xref/src/usr.sbin/cpuctl/arch/aarch64.c
 | 
			
		||||
		//
 | 
			
		||||
		// Fake the minimal features expected by
 | 
			
		||||
		// TestARM64minimalFeatures.
 | 
			
		||||
		ARM64.HasASIMD = true
 | 
			
		||||
		ARM64.HasFP = true
 | 
			
		||||
	case "linux":
 | 
			
		||||
	case "freebsd":
 | 
			
		||||
		readARM64Registers()
 | 
			
		||||
	case "linux", "netbsd":
 | 
			
		||||
		doinit()
 | 
			
		||||
	default:
 | 
			
		||||
		readARM64Registers()
 | 
			
		||||
		// Most platforms don't seem to allow reading these registers.
 | 
			
		||||
		//
 | 
			
		||||
		// OpenBSD:
 | 
			
		||||
		// See https://golang.org/issue/31746
 | 
			
		||||
		setMinimalFeatures()
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// setMinimalFeatures fakes the minimal ARM64 features expected by
 | 
			
		||||
// TestARM64minimalFeatures.
 | 
			
		||||
func setMinimalFeatures() {
 | 
			
		||||
	ARM64.HasASIMD = true
 | 
			
		||||
	ARM64.HasFP = true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func readARM64Registers() {
 | 
			
		||||
	Initialized = true
 | 
			
		||||
 | 
			
		||||
	// ID_AA64ISAR0_EL1
 | 
			
		||||
	isar0 := getisar0()
 | 
			
		||||
	parseARM64SystemRegisters(getisar0(), getisar1(), getpfr0())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) {
 | 
			
		||||
	// ID_AA64ISAR0_EL1
 | 
			
		||||
	switch extractBits(isar0, 4, 7) {
 | 
			
		||||
	case 1:
 | 
			
		||||
		ARM64.HasAES = true
 | 
			
		||||
@@ -121,8 +124,6 @@ func readARM64Registers() {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// ID_AA64ISAR1_EL1
 | 
			
		||||
	isar1 := getisar1()
 | 
			
		||||
 | 
			
		||||
	switch extractBits(isar1, 0, 3) {
 | 
			
		||||
	case 1:
 | 
			
		||||
		ARM64.HasDCPOP = true
 | 
			
		||||
@@ -144,8 +145,6 @@ func readARM64Registers() {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// ID_AA64PFR0_EL1
 | 
			
		||||
	pfr0 := getpfr0()
 | 
			
		||||
 | 
			
		||||
	switch extractBits(pfr0, 16, 19) {
 | 
			
		||||
	case 0:
 | 
			
		||||
		ARM64.HasFP = true
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										121
									
								
								vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										121
									
								
								vendor/golang.org/x/sys/cpu/cpu_linux_s390x.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -17,86 +17,7 @@ const (
 | 
			
		||||
	hwcap_VXE    = 8192
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// bitIsSet reports whether the bit at index is set. The bit index
 | 
			
		||||
// is in big endian order, so bit index 0 is the leftmost bit.
 | 
			
		||||
func bitIsSet(bits []uint64, index uint) bool {
 | 
			
		||||
	return bits[index/64]&((1<<63)>>(index%64)) != 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// function is the code for the named cryptographic function.
 | 
			
		||||
type function uint8
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// KM{,A,C,CTR} function codes
 | 
			
		||||
	aes128 function = 18 // AES-128
 | 
			
		||||
	aes192 function = 19 // AES-192
 | 
			
		||||
	aes256 function = 20 // AES-256
 | 
			
		||||
 | 
			
		||||
	// K{I,L}MD function codes
 | 
			
		||||
	sha1     function = 1  // SHA-1
 | 
			
		||||
	sha256   function = 2  // SHA-256
 | 
			
		||||
	sha512   function = 3  // SHA-512
 | 
			
		||||
	sha3_224 function = 32 // SHA3-224
 | 
			
		||||
	sha3_256 function = 33 // SHA3-256
 | 
			
		||||
	sha3_384 function = 34 // SHA3-384
 | 
			
		||||
	sha3_512 function = 35 // SHA3-512
 | 
			
		||||
	shake128 function = 36 // SHAKE-128
 | 
			
		||||
	shake256 function = 37 // SHAKE-256
 | 
			
		||||
 | 
			
		||||
	// KLMD function codes
 | 
			
		||||
	ghash function = 65 // GHASH
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// queryResult contains the result of a Query function
 | 
			
		||||
// call. Bits are numbered in big endian order so the
 | 
			
		||||
// leftmost bit (the MSB) is at index 0.
 | 
			
		||||
type queryResult struct {
 | 
			
		||||
	bits [2]uint64
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Has reports whether the given functions are present.
 | 
			
		||||
func (q *queryResult) Has(fns ...function) bool {
 | 
			
		||||
	if len(fns) == 0 {
 | 
			
		||||
		panic("no function codes provided")
 | 
			
		||||
	}
 | 
			
		||||
	for _, f := range fns {
 | 
			
		||||
		if !bitIsSet(q.bits[:], uint(f)) {
 | 
			
		||||
			return false
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// facility is a bit index for the named facility.
 | 
			
		||||
type facility uint8
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// cryptography facilities
 | 
			
		||||
	msa4 facility = 77  // message-security-assist extension 4
 | 
			
		||||
	msa8 facility = 146 // message-security-assist extension 8
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// facilityList contains the result of an STFLE call.
 | 
			
		||||
// Bits are numbered in big endian order so the
 | 
			
		||||
// leftmost bit (the MSB) is at index 0.
 | 
			
		||||
type facilityList struct {
 | 
			
		||||
	bits [4]uint64
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Has reports whether the given facilities are present.
 | 
			
		||||
func (s *facilityList) Has(fs ...facility) bool {
 | 
			
		||||
	if len(fs) == 0 {
 | 
			
		||||
		panic("no facility bits provided")
 | 
			
		||||
	}
 | 
			
		||||
	for _, f := range fs {
 | 
			
		||||
		if !bitIsSet(s.bits[:], uint(f)) {
 | 
			
		||||
			return false
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func doinit() {
 | 
			
		||||
func initS390Xbase() {
 | 
			
		||||
	// test HWCAP bit vector
 | 
			
		||||
	has := func(featureMask uint) bool {
 | 
			
		||||
		return hwCap&featureMask == featureMask
 | 
			
		||||
@@ -116,44 +37,4 @@ func doinit() {
 | 
			
		||||
	if S390X.HasVX {
 | 
			
		||||
		S390X.HasVXE = has(hwcap_VXE)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// We need implementations of stfle, km and so on
 | 
			
		||||
	// to detect cryptographic features.
 | 
			
		||||
	if !haveAsmFunctions() {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// optional cryptographic functions
 | 
			
		||||
	if S390X.HasMSA {
 | 
			
		||||
		aes := []function{aes128, aes192, aes256}
 | 
			
		||||
 | 
			
		||||
		// cipher message
 | 
			
		||||
		km, kmc := kmQuery(), kmcQuery()
 | 
			
		||||
		S390X.HasAES = km.Has(aes...)
 | 
			
		||||
		S390X.HasAESCBC = kmc.Has(aes...)
 | 
			
		||||
		if S390X.HasSTFLE {
 | 
			
		||||
			facilities := stfle()
 | 
			
		||||
			if facilities.Has(msa4) {
 | 
			
		||||
				kmctr := kmctrQuery()
 | 
			
		||||
				S390X.HasAESCTR = kmctr.Has(aes...)
 | 
			
		||||
			}
 | 
			
		||||
			if facilities.Has(msa8) {
 | 
			
		||||
				kma := kmaQuery()
 | 
			
		||||
				S390X.HasAESGCM = kma.Has(aes...)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// compute message digest
 | 
			
		||||
		kimd := kimdQuery() // intermediate (no padding)
 | 
			
		||||
		klmd := klmdQuery() // last (padding)
 | 
			
		||||
		S390X.HasSHA1 = kimd.Has(sha1) && klmd.Has(sha1)
 | 
			
		||||
		S390X.HasSHA256 = kimd.Has(sha256) && klmd.Has(sha256)
 | 
			
		||||
		S390X.HasSHA512 = kimd.Has(sha512) && klmd.Has(sha512)
 | 
			
		||||
		S390X.HasGHASH = kimd.Has(ghash) // KLMD-GHASH does not exist
 | 
			
		||||
		sha3 := []function{
 | 
			
		||||
			sha3_224, sha3_256, sha3_384, sha3_512,
 | 
			
		||||
			shake128, shake256,
 | 
			
		||||
		}
 | 
			
		||||
		S390X.HasSHA3 = kimd.Has(sha3...) && klmd.Has(sha3...)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										173
									
								
								vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										173
									
								
								vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,173 @@
 | 
			
		||||
// Copyright 2020 The Go Authors. All rights reserved.
 | 
			
		||||
// Use of this source code is governed by a BSD-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
package cpu
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"syscall"
 | 
			
		||||
	"unsafe"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Minimal copy of functionality from x/sys/unix so the cpu package can call
 | 
			
		||||
// sysctl without depending on x/sys/unix.
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	_CTL_QUERY = -2
 | 
			
		||||
 | 
			
		||||
	_SYSCTL_VERS_1 = 0x1000000
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var _zero uintptr
 | 
			
		||||
 | 
			
		||||
func sysctl(mib []int32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
 | 
			
		||||
	var _p0 unsafe.Pointer
 | 
			
		||||
	if len(mib) > 0 {
 | 
			
		||||
		_p0 = unsafe.Pointer(&mib[0])
 | 
			
		||||
	} else {
 | 
			
		||||
		_p0 = unsafe.Pointer(&_zero)
 | 
			
		||||
	}
 | 
			
		||||
	_, _, errno := syscall.Syscall6(
 | 
			
		||||
		syscall.SYS___SYSCTL,
 | 
			
		||||
		uintptr(_p0),
 | 
			
		||||
		uintptr(len(mib)),
 | 
			
		||||
		uintptr(unsafe.Pointer(old)),
 | 
			
		||||
		uintptr(unsafe.Pointer(oldlen)),
 | 
			
		||||
		uintptr(unsafe.Pointer(new)),
 | 
			
		||||
		uintptr(newlen))
 | 
			
		||||
	if errno != 0 {
 | 
			
		||||
		return errno
 | 
			
		||||
	}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type sysctlNode struct {
 | 
			
		||||
	Flags          uint32
 | 
			
		||||
	Num            int32
 | 
			
		||||
	Name           [32]int8
 | 
			
		||||
	Ver            uint32
 | 
			
		||||
	__rsvd         uint32
 | 
			
		||||
	Un             [16]byte
 | 
			
		||||
	_sysctl_size   [8]byte
 | 
			
		||||
	_sysctl_func   [8]byte
 | 
			
		||||
	_sysctl_parent [8]byte
 | 
			
		||||
	_sysctl_desc   [8]byte
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func sysctlNodes(mib []int32) ([]sysctlNode, error) {
 | 
			
		||||
	var olen uintptr
 | 
			
		||||
 | 
			
		||||
	// Get a list of all sysctl nodes below the given MIB by performing
 | 
			
		||||
	// a sysctl for the given MIB with CTL_QUERY appended.
 | 
			
		||||
	mib = append(mib, _CTL_QUERY)
 | 
			
		||||
	qnode := sysctlNode{Flags: _SYSCTL_VERS_1}
 | 
			
		||||
	qp := (*byte)(unsafe.Pointer(&qnode))
 | 
			
		||||
	sz := unsafe.Sizeof(qnode)
 | 
			
		||||
	if err := sysctl(mib, nil, &olen, qp, sz); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Now that we know the size, get the actual nodes.
 | 
			
		||||
	nodes := make([]sysctlNode, olen/sz)
 | 
			
		||||
	np := (*byte)(unsafe.Pointer(&nodes[0]))
 | 
			
		||||
	if err := sysctl(mib, np, &olen, qp, sz); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nodes, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func nametomib(name string) ([]int32, error) {
 | 
			
		||||
	// Split name into components.
 | 
			
		||||
	var parts []string
 | 
			
		||||
	last := 0
 | 
			
		||||
	for i := 0; i < len(name); i++ {
 | 
			
		||||
		if name[i] == '.' {
 | 
			
		||||
			parts = append(parts, name[last:i])
 | 
			
		||||
			last = i + 1
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	parts = append(parts, name[last:])
 | 
			
		||||
 | 
			
		||||
	mib := []int32{}
 | 
			
		||||
	// Discover the nodes and construct the MIB OID.
 | 
			
		||||
	for partno, part := range parts {
 | 
			
		||||
		nodes, err := sysctlNodes(mib)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
		for _, node := range nodes {
 | 
			
		||||
			n := make([]byte, 0)
 | 
			
		||||
			for i := range node.Name {
 | 
			
		||||
				if node.Name[i] != 0 {
 | 
			
		||||
					n = append(n, byte(node.Name[i]))
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			if string(n) == part {
 | 
			
		||||
				mib = append(mib, int32(node.Num))
 | 
			
		||||
				break
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if len(mib) != partno+1 {
 | 
			
		||||
			return nil, err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return mib, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// aarch64SysctlCPUID is struct aarch64_sysctl_cpu_id from NetBSD's <aarch64/armreg.h>
 | 
			
		||||
type aarch64SysctlCPUID struct {
 | 
			
		||||
	midr      uint64 /* Main ID Register */
 | 
			
		||||
	revidr    uint64 /* Revision ID Register */
 | 
			
		||||
	mpidr     uint64 /* Multiprocessor Affinity Register */
 | 
			
		||||
	aa64dfr0  uint64 /* A64 Debug Feature Register 0 */
 | 
			
		||||
	aa64dfr1  uint64 /* A64 Debug Feature Register 1 */
 | 
			
		||||
	aa64isar0 uint64 /* A64 Instruction Set Attribute Register 0 */
 | 
			
		||||
	aa64isar1 uint64 /* A64 Instruction Set Attribute Register 1 */
 | 
			
		||||
	aa64mmfr0 uint64 /* A64 Memory Model Feature Register 0 */
 | 
			
		||||
	aa64mmfr1 uint64 /* A64 Memory Model Feature Register 1 */
 | 
			
		||||
	aa64mmfr2 uint64 /* A64 Memory Model Feature Register 2 */
 | 
			
		||||
	aa64pfr0  uint64 /* A64 Processor Feature Register 0 */
 | 
			
		||||
	aa64pfr1  uint64 /* A64 Processor Feature Register 1 */
 | 
			
		||||
	aa64zfr0  uint64 /* A64 SVE Feature ID Register 0 */
 | 
			
		||||
	mvfr0     uint32 /* Media and VFP Feature Register 0 */
 | 
			
		||||
	mvfr1     uint32 /* Media and VFP Feature Register 1 */
 | 
			
		||||
	mvfr2     uint32 /* Media and VFP Feature Register 2 */
 | 
			
		||||
	pad       uint32
 | 
			
		||||
	clidr     uint64 /* Cache Level ID Register */
 | 
			
		||||
	ctr       uint64 /* Cache Type Register */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func sysctlCPUID(name string) (*aarch64SysctlCPUID, error) {
 | 
			
		||||
	mib, err := nametomib(name)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	out := aarch64SysctlCPUID{}
 | 
			
		||||
	n := unsafe.Sizeof(out)
 | 
			
		||||
	_, _, errno := syscall.Syscall6(
 | 
			
		||||
		syscall.SYS___SYSCTL,
 | 
			
		||||
		uintptr(unsafe.Pointer(&mib[0])),
 | 
			
		||||
		uintptr(len(mib)),
 | 
			
		||||
		uintptr(unsafe.Pointer(&out)),
 | 
			
		||||
		uintptr(unsafe.Pointer(&n)),
 | 
			
		||||
		uintptr(0),
 | 
			
		||||
		uintptr(0))
 | 
			
		||||
	if errno != 0 {
 | 
			
		||||
		return nil, errno
 | 
			
		||||
	}
 | 
			
		||||
	return &out, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func doinit() {
 | 
			
		||||
	cpuid, err := sysctlCPUID("machdep.cpu0.cpu_id")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		setMinimalFeatures()
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	parseARM64SystemRegisters(cpuid.aa64isar0, cpuid.aa64isar1, cpuid.aa64pfr0)
 | 
			
		||||
 | 
			
		||||
	Initialized = true
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										3
									
								
								vendor/golang.org/x/sys/cpu/cpu_other_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/golang.org/x/sys/cpu/cpu_other_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -2,7 +2,8 @@
 | 
			
		||||
// Use of this source code is governed by a BSD-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
// +build !linux,arm64
 | 
			
		||||
// +build !linux,!netbsd
 | 
			
		||||
// +build arm64
 | 
			
		||||
 | 
			
		||||
package cpu
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								vendor/golang.org/x/sys/cpu/cpu_other_mips64x.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
// Copyright 2020 The Go Authors. All rights reserved.
 | 
			
		||||
// Use of this source code is governed by a BSD-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
// +build !linux
 | 
			
		||||
// +build mips64 mips64le
 | 
			
		||||
 | 
			
		||||
package cpu
 | 
			
		||||
 | 
			
		||||
func archInit() {
 | 
			
		||||
	Initialized = true
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										150
									
								
								vendor/golang.org/x/sys/cpu/cpu_s390x.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										150
									
								
								vendor/golang.org/x/sys/cpu/cpu_s390x.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -8,10 +8,10 @@ const cacheLineSize = 256
 | 
			
		||||
 | 
			
		||||
func initOptions() {
 | 
			
		||||
	options = []option{
 | 
			
		||||
		{Name: "zarch", Feature: &S390X.HasZARCH},
 | 
			
		||||
		{Name: "stfle", Feature: &S390X.HasSTFLE},
 | 
			
		||||
		{Name: "ldisp", Feature: &S390X.HasLDISP},
 | 
			
		||||
		{Name: "eimm", Feature: &S390X.HasEIMM},
 | 
			
		||||
		{Name: "zarch", Feature: &S390X.HasZARCH, Required: true},
 | 
			
		||||
		{Name: "stfle", Feature: &S390X.HasSTFLE, Required: true},
 | 
			
		||||
		{Name: "ldisp", Feature: &S390X.HasLDISP, Required: true},
 | 
			
		||||
		{Name: "eimm", Feature: &S390X.HasEIMM, Required: true},
 | 
			
		||||
		{Name: "dfp", Feature: &S390X.HasDFP},
 | 
			
		||||
		{Name: "etf3eh", Feature: &S390X.HasETF3EH},
 | 
			
		||||
		{Name: "msa", Feature: &S390X.HasMSA},
 | 
			
		||||
@@ -28,3 +28,145 @@ func initOptions() {
 | 
			
		||||
		{Name: "vxe", Feature: &S390X.HasVXE},
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// bitIsSet reports whether the bit at index is set. The bit index
 | 
			
		||||
// is in big endian order, so bit index 0 is the leftmost bit.
 | 
			
		||||
func bitIsSet(bits []uint64, index uint) bool {
 | 
			
		||||
	return bits[index/64]&((1<<63)>>(index%64)) != 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// facility is a bit index for the named facility.
 | 
			
		||||
type facility uint8
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// mandatory facilities
 | 
			
		||||
	zarch  facility = 1  // z architecture mode is active
 | 
			
		||||
	stflef facility = 7  // store-facility-list-extended
 | 
			
		||||
	ldisp  facility = 18 // long-displacement
 | 
			
		||||
	eimm   facility = 21 // extended-immediate
 | 
			
		||||
 | 
			
		||||
	// miscellaneous facilities
 | 
			
		||||
	dfp    facility = 42 // decimal-floating-point
 | 
			
		||||
	etf3eh facility = 30 // extended-translation 3 enhancement
 | 
			
		||||
 | 
			
		||||
	// cryptography facilities
 | 
			
		||||
	msa  facility = 17  // message-security-assist
 | 
			
		||||
	msa3 facility = 76  // message-security-assist extension 3
 | 
			
		||||
	msa4 facility = 77  // message-security-assist extension 4
 | 
			
		||||
	msa5 facility = 57  // message-security-assist extension 5
 | 
			
		||||
	msa8 facility = 146 // message-security-assist extension 8
 | 
			
		||||
	msa9 facility = 155 // message-security-assist extension 9
 | 
			
		||||
 | 
			
		||||
	// vector facilities
 | 
			
		||||
	vx   facility = 129 // vector facility
 | 
			
		||||
	vxe  facility = 135 // vector-enhancements 1
 | 
			
		||||
	vxe2 facility = 148 // vector-enhancements 2
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// facilityList contains the result of an STFLE call.
 | 
			
		||||
// Bits are numbered in big endian order so the
 | 
			
		||||
// leftmost bit (the MSB) is at index 0.
 | 
			
		||||
type facilityList struct {
 | 
			
		||||
	bits [4]uint64
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Has reports whether the given facilities are present.
 | 
			
		||||
func (s *facilityList) Has(fs ...facility) bool {
 | 
			
		||||
	if len(fs) == 0 {
 | 
			
		||||
		panic("no facility bits provided")
 | 
			
		||||
	}
 | 
			
		||||
	for _, f := range fs {
 | 
			
		||||
		if !bitIsSet(s.bits[:], uint(f)) {
 | 
			
		||||
			return false
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// function is the code for the named cryptographic function.
 | 
			
		||||
type function uint8
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	// KM{,A,C,CTR} function codes
 | 
			
		||||
	aes128 function = 18 // AES-128
 | 
			
		||||
	aes192 function = 19 // AES-192
 | 
			
		||||
	aes256 function = 20 // AES-256
 | 
			
		||||
 | 
			
		||||
	// K{I,L}MD function codes
 | 
			
		||||
	sha1     function = 1  // SHA-1
 | 
			
		||||
	sha256   function = 2  // SHA-256
 | 
			
		||||
	sha512   function = 3  // SHA-512
 | 
			
		||||
	sha3_224 function = 32 // SHA3-224
 | 
			
		||||
	sha3_256 function = 33 // SHA3-256
 | 
			
		||||
	sha3_384 function = 34 // SHA3-384
 | 
			
		||||
	sha3_512 function = 35 // SHA3-512
 | 
			
		||||
	shake128 function = 36 // SHAKE-128
 | 
			
		||||
	shake256 function = 37 // SHAKE-256
 | 
			
		||||
 | 
			
		||||
	// KLMD function codes
 | 
			
		||||
	ghash function = 65 // GHASH
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// queryResult contains the result of a Query function
 | 
			
		||||
// call. Bits are numbered in big endian order so the
 | 
			
		||||
// leftmost bit (the MSB) is at index 0.
 | 
			
		||||
type queryResult struct {
 | 
			
		||||
	bits [2]uint64
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Has reports whether the given functions are present.
 | 
			
		||||
func (q *queryResult) Has(fns ...function) bool {
 | 
			
		||||
	if len(fns) == 0 {
 | 
			
		||||
		panic("no function codes provided")
 | 
			
		||||
	}
 | 
			
		||||
	for _, f := range fns {
 | 
			
		||||
		if !bitIsSet(q.bits[:], uint(f)) {
 | 
			
		||||
			return false
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func doinit() {
 | 
			
		||||
	initS390Xbase()
 | 
			
		||||
 | 
			
		||||
	// We need implementations of stfle, km and so on
 | 
			
		||||
	// to detect cryptographic features.
 | 
			
		||||
	if !haveAsmFunctions() {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// optional cryptographic functions
 | 
			
		||||
	if S390X.HasMSA {
 | 
			
		||||
		aes := []function{aes128, aes192, aes256}
 | 
			
		||||
 | 
			
		||||
		// cipher message
 | 
			
		||||
		km, kmc := kmQuery(), kmcQuery()
 | 
			
		||||
		S390X.HasAES = km.Has(aes...)
 | 
			
		||||
		S390X.HasAESCBC = kmc.Has(aes...)
 | 
			
		||||
		if S390X.HasSTFLE {
 | 
			
		||||
			facilities := stfle()
 | 
			
		||||
			if facilities.Has(msa4) {
 | 
			
		||||
				kmctr := kmctrQuery()
 | 
			
		||||
				S390X.HasAESCTR = kmctr.Has(aes...)
 | 
			
		||||
			}
 | 
			
		||||
			if facilities.Has(msa8) {
 | 
			
		||||
				kma := kmaQuery()
 | 
			
		||||
				S390X.HasAESGCM = kma.Has(aes...)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// compute message digest
 | 
			
		||||
		kimd := kimdQuery() // intermediate (no padding)
 | 
			
		||||
		klmd := klmdQuery() // last (padding)
 | 
			
		||||
		S390X.HasSHA1 = kimd.Has(sha1) && klmd.Has(sha1)
 | 
			
		||||
		S390X.HasSHA256 = kimd.Has(sha256) && klmd.Has(sha256)
 | 
			
		||||
		S390X.HasSHA512 = kimd.Has(sha512) && klmd.Has(sha512)
 | 
			
		||||
		S390X.HasGHASH = kimd.Has(ghash) // KLMD-GHASH does not exist
 | 
			
		||||
		sha3 := []function{
 | 
			
		||||
			sha3_224, sha3_256, sha3_384, sha3_512,
 | 
			
		||||
			shake128, shake256,
 | 
			
		||||
		}
 | 
			
		||||
		S390X.HasSHA3 = kimd.Has(sha3...) && klmd.Has(sha3...)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										51
									
								
								vendor/golang.org/x/sys/cpu/cpu_x86.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										51
									
								
								vendor/golang.org/x/sys/cpu/cpu_x86.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -16,6 +16,26 @@ func initOptions() {
 | 
			
		||||
		{Name: "aes", Feature: &X86.HasAES},
 | 
			
		||||
		{Name: "avx", Feature: &X86.HasAVX},
 | 
			
		||||
		{Name: "avx2", Feature: &X86.HasAVX2},
 | 
			
		||||
		{Name: "avx512", Feature: &X86.HasAVX512},
 | 
			
		||||
		{Name: "avx512f", Feature: &X86.HasAVX512F},
 | 
			
		||||
		{Name: "avx512cd", Feature: &X86.HasAVX512CD},
 | 
			
		||||
		{Name: "avx512er", Feature: &X86.HasAVX512ER},
 | 
			
		||||
		{Name: "avx512pf", Feature: &X86.HasAVX512PF},
 | 
			
		||||
		{Name: "avx512vl", Feature: &X86.HasAVX512VL},
 | 
			
		||||
		{Name: "avx512bw", Feature: &X86.HasAVX512BW},
 | 
			
		||||
		{Name: "avx512dq", Feature: &X86.HasAVX512DQ},
 | 
			
		||||
		{Name: "avx512ifma", Feature: &X86.HasAVX512IFMA},
 | 
			
		||||
		{Name: "avx512vbmi", Feature: &X86.HasAVX512VBMI},
 | 
			
		||||
		{Name: "avx512vnniw", Feature: &X86.HasAVX5124VNNIW},
 | 
			
		||||
		{Name: "avx5124fmaps", Feature: &X86.HasAVX5124FMAPS},
 | 
			
		||||
		{Name: "avx512vpopcntdq", Feature: &X86.HasAVX512VPOPCNTDQ},
 | 
			
		||||
		{Name: "avx512vpclmulqdq", Feature: &X86.HasAVX512VPCLMULQDQ},
 | 
			
		||||
		{Name: "avx512vnni", Feature: &X86.HasAVX512VNNI},
 | 
			
		||||
		{Name: "avx512gfni", Feature: &X86.HasAVX512GFNI},
 | 
			
		||||
		{Name: "avx512vaes", Feature: &X86.HasAVX512VAES},
 | 
			
		||||
		{Name: "avx512vbmi2", Feature: &X86.HasAVX512VBMI2},
 | 
			
		||||
		{Name: "avx512bitalg", Feature: &X86.HasAVX512BITALG},
 | 
			
		||||
		{Name: "avx512bf16", Feature: &X86.HasAVX512BF16},
 | 
			
		||||
		{Name: "bmi1", Feature: &X86.HasBMI1},
 | 
			
		||||
		{Name: "bmi2", Feature: &X86.HasBMI2},
 | 
			
		||||
		{Name: "erms", Feature: &X86.HasERMS},
 | 
			
		||||
@@ -59,12 +79,15 @@ func archInit() {
 | 
			
		||||
	X86.HasOSXSAVE = isSet(27, ecx1)
 | 
			
		||||
	X86.HasRDRAND = isSet(30, ecx1)
 | 
			
		||||
 | 
			
		||||
	osSupportsAVX := false
 | 
			
		||||
	var osSupportsAVX, osSupportsAVX512 bool
 | 
			
		||||
	// For XGETBV, OSXSAVE bit is required and sufficient.
 | 
			
		||||
	if X86.HasOSXSAVE {
 | 
			
		||||
		eax, _ := xgetbv()
 | 
			
		||||
		// Check if XMM and YMM registers have OS support.
 | 
			
		||||
		osSupportsAVX = isSet(1, eax) && isSet(2, eax)
 | 
			
		||||
 | 
			
		||||
		// Check if OPMASK and ZMM registers have OS support.
 | 
			
		||||
		osSupportsAVX512 = osSupportsAVX && isSet(5, eax) && isSet(6, eax) && isSet(7, eax)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	X86.HasAVX = isSet(28, ecx1) && osSupportsAVX
 | 
			
		||||
@@ -73,7 +96,7 @@ func archInit() {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	_, ebx7, _, _ := cpuid(7, 0)
 | 
			
		||||
	_, ebx7, ecx7, edx7 := cpuid(7, 0)
 | 
			
		||||
	X86.HasBMI1 = isSet(3, ebx7)
 | 
			
		||||
	X86.HasAVX2 = isSet(5, ebx7) && osSupportsAVX
 | 
			
		||||
	X86.HasBMI2 = isSet(8, ebx7)
 | 
			
		||||
@@ -81,6 +104,30 @@ func archInit() {
 | 
			
		||||
	X86.HasRDSEED = isSet(18, ebx7)
 | 
			
		||||
	X86.HasADX = isSet(19, ebx7)
 | 
			
		||||
 | 
			
		||||
	X86.HasAVX512 = isSet(16, ebx7) && osSupportsAVX512 // Because avx-512 foundation is the core required extension
 | 
			
		||||
	if X86.HasAVX512 {
 | 
			
		||||
		X86.HasAVX512F = true
 | 
			
		||||
		X86.HasAVX512CD = isSet(28, ebx7)
 | 
			
		||||
		X86.HasAVX512ER = isSet(27, ebx7)
 | 
			
		||||
		X86.HasAVX512PF = isSet(26, ebx7)
 | 
			
		||||
		X86.HasAVX512VL = isSet(31, ebx7)
 | 
			
		||||
		X86.HasAVX512BW = isSet(30, ebx7)
 | 
			
		||||
		X86.HasAVX512DQ = isSet(17, ebx7)
 | 
			
		||||
		X86.HasAVX512IFMA = isSet(21, ebx7)
 | 
			
		||||
		X86.HasAVX512VBMI = isSet(1, ecx7)
 | 
			
		||||
		X86.HasAVX5124VNNIW = isSet(2, edx7)
 | 
			
		||||
		X86.HasAVX5124FMAPS = isSet(3, edx7)
 | 
			
		||||
		X86.HasAVX512VPOPCNTDQ = isSet(14, ecx7)
 | 
			
		||||
		X86.HasAVX512VPCLMULQDQ = isSet(10, ecx7)
 | 
			
		||||
		X86.HasAVX512VNNI = isSet(11, ecx7)
 | 
			
		||||
		X86.HasAVX512GFNI = isSet(8, ecx7)
 | 
			
		||||
		X86.HasAVX512VAES = isSet(9, ecx7)
 | 
			
		||||
		X86.HasAVX512VBMI2 = isSet(6, ecx7)
 | 
			
		||||
		X86.HasAVX512BITALG = isSet(12, ecx7)
 | 
			
		||||
 | 
			
		||||
		eax71, _, _, _ := cpuid(7, 1)
 | 
			
		||||
		X86.HasAVX512BF16 = isSet(5, eax71)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func isSet(bitpos uint, value uint32) bool {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								vendor/golang.org/x/sys/cpu/cpu_zos.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								vendor/golang.org/x/sys/cpu/cpu_zos.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
// Copyright 2020 The Go Authors. All rights reserved.
 | 
			
		||||
// Use of this source code is governed by a BSD-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
package cpu
 | 
			
		||||
 | 
			
		||||
func archInit() {
 | 
			
		||||
	doinit()
 | 
			
		||||
	Initialized = true
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										25
									
								
								vendor/golang.org/x/sys/cpu/cpu_zos_s390x.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								vendor/golang.org/x/sys/cpu/cpu_zos_s390x.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
// Copyright 2020 The Go Authors. All rights reserved.
 | 
			
		||||
// Use of this source code is governed by a BSD-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
package cpu
 | 
			
		||||
 | 
			
		||||
func initS390Xbase() {
 | 
			
		||||
	// get the facilities list
 | 
			
		||||
	facilities := stfle()
 | 
			
		||||
 | 
			
		||||
	// mandatory
 | 
			
		||||
	S390X.HasZARCH = facilities.Has(zarch)
 | 
			
		||||
	S390X.HasSTFLE = facilities.Has(stflef)
 | 
			
		||||
	S390X.HasLDISP = facilities.Has(ldisp)
 | 
			
		||||
	S390X.HasEIMM = facilities.Has(eimm)
 | 
			
		||||
 | 
			
		||||
	// optional
 | 
			
		||||
	S390X.HasETF3EH = facilities.Has(etf3eh)
 | 
			
		||||
	S390X.HasDFP = facilities.Has(dfp)
 | 
			
		||||
	S390X.HasMSA = facilities.Has(msa)
 | 
			
		||||
	S390X.HasVX = facilities.Has(vx)
 | 
			
		||||
	if S390X.HasVX {
 | 
			
		||||
		S390X.HasVXE = facilities.Has(vxe)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										6
									
								
								vendor/golang.org/x/sys/unix/fcntl_darwin.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/golang.org/x/sys/unix/fcntl_darwin.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -16,3 +16,9 @@ func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
 | 
			
		||||
	_, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk))))
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// FcntlFstore performs a fcntl syscall for the F_PREALLOCATE command.
 | 
			
		||||
func FcntlFstore(fd uintptr, cmd int, fstore *Fstore_t) error {
 | 
			
		||||
	_, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(fstore))))
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,9 +1,9 @@
 | 
			
		||||
// +build linux,386 linux,arm linux,mips linux,mipsle
 | 
			
		||||
 | 
			
		||||
// Copyright 2014 The Go Authors. All rights reserved.
 | 
			
		||||
// Use of this source code is governed by a BSD-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
// +build linux,386 linux,arm linux,mips linux,mipsle
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/golang.org/x/sys/unix/gccgo.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/golang.org/x/sys/unix/gccgo.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -12,10 +12,8 @@ import "syscall"
 | 
			
		||||
// We can't use the gc-syntax .s files for gccgo. On the plus side
 | 
			
		||||
// much of the functionality can be written directly in Go.
 | 
			
		||||
 | 
			
		||||
//extern gccgoRealSyscallNoError
 | 
			
		||||
func realSyscallNoError(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r uintptr)
 | 
			
		||||
 | 
			
		||||
//extern gccgoRealSyscall
 | 
			
		||||
func realSyscall(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r, errno uintptr)
 | 
			
		||||
 | 
			
		||||
func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								vendor/golang.org/x/sys/unix/gccgo_c.c
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/golang.org/x/sys/unix/gccgo_c.c
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -21,6 +21,9 @@ struct ret {
 | 
			
		||||
	uintptr_t err;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct ret gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
 | 
			
		||||
  __asm__(GOSYM_PREFIX GOPKGPATH ".realSyscall");
 | 
			
		||||
 | 
			
		||||
struct ret
 | 
			
		||||
gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
 | 
			
		||||
{
 | 
			
		||||
@@ -32,6 +35,9 @@ gccgoRealSyscall(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintp
 | 
			
		||||
	return r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uintptr_t gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
 | 
			
		||||
  __asm__(GOSYM_PREFIX GOPKGPATH ".realSyscallNoError");
 | 
			
		||||
 | 
			
		||||
uintptr_t
 | 
			
		||||
gccgoRealSyscallNoError(uintptr_t trap, uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5, uintptr_t a6, uintptr_t a7, uintptr_t a8, uintptr_t a9)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								vendor/golang.org/x/sys/unix/mkall.sh
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/golang.org/x/sys/unix/mkall.sh
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -73,26 +73,22 @@ aix_ppc64)
 | 
			
		||||
darwin_386)
 | 
			
		||||
	mkerrors="$mkerrors -m32"
 | 
			
		||||
	mksyscall="go run mksyscall.go -l32"
 | 
			
		||||
	mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
 | 
			
		||||
	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
 | 
			
		||||
	mkasm="go run mkasm_darwin.go"
 | 
			
		||||
	;;
 | 
			
		||||
darwin_amd64)
 | 
			
		||||
	mkerrors="$mkerrors -m64"
 | 
			
		||||
	mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
 | 
			
		||||
	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
 | 
			
		||||
	mkasm="go run mkasm_darwin.go"
 | 
			
		||||
	;;
 | 
			
		||||
darwin_arm)
 | 
			
		||||
	mkerrors="$mkerrors"
 | 
			
		||||
	mksyscall="go run mksyscall.go -l32"
 | 
			
		||||
	mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
 | 
			
		||||
	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
 | 
			
		||||
	mkasm="go run mkasm_darwin.go"
 | 
			
		||||
	;;
 | 
			
		||||
darwin_arm64)
 | 
			
		||||
	mkerrors="$mkerrors -m64"
 | 
			
		||||
	mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
 | 
			
		||||
	mktypes="GOARCH=$GOARCH go tool cgo -godefs"
 | 
			
		||||
	mkasm="go run mkasm_darwin.go"
 | 
			
		||||
	;;
 | 
			
		||||
@@ -226,8 +222,6 @@ esac
 | 
			
		||||
				# aix/ppc64 script generates files instead of writing to stdin.
 | 
			
		||||
				echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ;
 | 
			
		||||
			elif [ "$GOOS" == "darwin" ]; then
 | 
			
		||||
			        # pre-1.12, direct syscalls
 | 
			
		||||
			        echo "$mksyscall -tags $GOOS,$GOARCH,!go1.12 $syscall_goos syscall_darwin_${GOARCH}.1_11.go $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.1_11.go";
 | 
			
		||||
			        # 1.12 and later, syscalls via libSystem
 | 
			
		||||
				echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
 | 
			
		||||
				# 1.13 and later, syscalls via libSystem (including syscallPtr)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										15
									
								
								vendor/golang.org/x/sys/unix/mkerrors.sh
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								vendor/golang.org/x/sys/unix/mkerrors.sh
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -58,12 +58,15 @@ includes_Darwin='
 | 
			
		||||
#define _DARWIN_USE_64_BIT_INODE
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
#include <sys/attr.h>
 | 
			
		||||
#include <sys/clonefile.h>
 | 
			
		||||
#include <sys/kern_control.h>
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/event.h>
 | 
			
		||||
#include <sys/ptrace.h>
 | 
			
		||||
#include <sys/select.h>
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <sys/sockio.h>
 | 
			
		||||
#include <sys/sys_domain.h>
 | 
			
		||||
#include <sys/sysctl.h>
 | 
			
		||||
#include <sys/mman.h>
 | 
			
		||||
#include <sys/mount.h>
 | 
			
		||||
@@ -93,6 +96,7 @@ includes_DragonFly='
 | 
			
		||||
#include <sys/ioctl.h>
 | 
			
		||||
#include <net/bpf.h>
 | 
			
		||||
#include <net/if.h>
 | 
			
		||||
#include <net/if_clone.h>
 | 
			
		||||
#include <net/if_types.h>
 | 
			
		||||
#include <net/route.h>
 | 
			
		||||
#include <netinet/in.h>
 | 
			
		||||
@@ -193,6 +197,8 @@ struct ltchars {
 | 
			
		||||
#include <sys/xattr.h>
 | 
			
		||||
#include <linux/bpf.h>
 | 
			
		||||
#include <linux/can.h>
 | 
			
		||||
#include <linux/can/error.h>
 | 
			
		||||
#include <linux/can/raw.h>
 | 
			
		||||
#include <linux/capability.h>
 | 
			
		||||
#include <linux/cryptouser.h>
 | 
			
		||||
#include <linux/devlink.h>
 | 
			
		||||
@@ -227,6 +233,7 @@ struct ltchars {
 | 
			
		||||
#include <linux/net_namespace.h>
 | 
			
		||||
#include <linux/nsfs.h>
 | 
			
		||||
#include <linux/perf_event.h>
 | 
			
		||||
#include <linux/pps.h>
 | 
			
		||||
#include <linux/ptrace.h>
 | 
			
		||||
#include <linux/random.h>
 | 
			
		||||
#include <linux/reboot.h>
 | 
			
		||||
@@ -369,6 +376,7 @@ includes_SunOS='
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <sys/sockio.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include <sys/stream.h>
 | 
			
		||||
#include <sys/mman.h>
 | 
			
		||||
#include <sys/wait.h>
 | 
			
		||||
#include <sys/ioctl.h>
 | 
			
		||||
@@ -493,6 +501,7 @@ ccflags="$@"
 | 
			
		||||
		$2 !~ "NLA_TYPE_MASK" &&
 | 
			
		||||
		$2 !~ /^RTC_VL_(ACCURACY|BACKUP|DATA)/ &&
 | 
			
		||||
		$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTC|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P|NETNSA)_/ ||
 | 
			
		||||
		$2 ~ /^FIORDCHK$/ ||
 | 
			
		||||
		$2 ~ /^SIOC/ ||
 | 
			
		||||
		$2 ~ /^TIOC/ ||
 | 
			
		||||
		$2 ~ /^TCGET/ ||
 | 
			
		||||
@@ -513,7 +522,9 @@ ccflags="$@"
 | 
			
		||||
		$2 ~ /^CAP_/ ||
 | 
			
		||||
		$2 ~ /^CP_/ ||
 | 
			
		||||
		$2 ~ /^CPUSTATES$/ ||
 | 
			
		||||
		$2 ~ /^CTLIOCGINFO$/ ||
 | 
			
		||||
		$2 ~ /^ALG_/ ||
 | 
			
		||||
		$2 ~ /^FI(CLONE|DEDUPERANGE)/ ||
 | 
			
		||||
		$2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE)/ ||
 | 
			
		||||
		$2 ~ /^FS_IOC_.*(ENCRYPTION|VERITY|[GS]ETFLAGS)/ ||
 | 
			
		||||
		$2 ~ /^FS_VERITY_/ ||
 | 
			
		||||
@@ -523,7 +534,7 @@ ccflags="$@"
 | 
			
		||||
		$2 ~ /^RND/ ||
 | 
			
		||||
		$2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
 | 
			
		||||
		$2 ~ /^KEYCTL_/ ||
 | 
			
		||||
		$2 ~ /^PERF_EVENT_IOC_/ ||
 | 
			
		||||
		$2 ~ /^PERF_/ ||
 | 
			
		||||
		$2 ~ /^SECCOMP_MODE_/ ||
 | 
			
		||||
		$2 ~ /^SPLICE_/ ||
 | 
			
		||||
		$2 ~ /^SYNC_FILE_RANGE_/ ||
 | 
			
		||||
@@ -542,7 +553,7 @@ ccflags="$@"
 | 
			
		||||
		$2 ~ /^XATTR_(CREATE|REPLACE|NO(DEFAULT|FOLLOW|SECURITY)|SHOWCOMPRESSION)/ ||
 | 
			
		||||
		$2 ~ /^ATTR_(BIT_MAP_COUNT|(CMN|VOL|FILE)_)/ ||
 | 
			
		||||
		$2 ~ /^FSOPT_/ ||
 | 
			
		||||
		$2 ~ /^WDIOC_/ ||
 | 
			
		||||
		$2 ~ /^WDIO[CFS]_/ ||
 | 
			
		||||
		$2 ~ /^NFN/ ||
 | 
			
		||||
		$2 ~ /^XDP_/ ||
 | 
			
		||||
		$2 ~ /^RWF_/ ||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -20,7 +20,7 @@ func cmsgAlignOf(salen int) int {
 | 
			
		||||
	case "aix":
 | 
			
		||||
		// There is no alignment on AIX.
 | 
			
		||||
		salign = 1
 | 
			
		||||
	case "darwin", "illumos", "solaris":
 | 
			
		||||
	case "darwin", "ios", "illumos", "solaris":
 | 
			
		||||
		// NOTE: It seems like 64-bit Darwin, Illumos and Solaris
 | 
			
		||||
		// kernels still require 32-bit aligned access to network
 | 
			
		||||
		// subsystem.
 | 
			
		||||
@@ -32,6 +32,10 @@ func cmsgAlignOf(salen int) int {
 | 
			
		||||
		if runtime.GOARCH == "arm" {
 | 
			
		||||
			salign = 8
 | 
			
		||||
		}
 | 
			
		||||
		// NetBSD aarch64 requires 128-bit alignment.
 | 
			
		||||
		if runtime.GOOS == "netbsd" && runtime.GOARCH == "arm64" {
 | 
			
		||||
			salign = 16
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return (salen + salign - 1) & ^(salign - 1)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										43
									
								
								vendor/golang.org/x/sys/unix/syscall.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										43
									
								
								vendor/golang.org/x/sys/unix/syscall.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -24,7 +24,13 @@
 | 
			
		||||
// holds a value of type syscall.Errno.
 | 
			
		||||
package unix // import "golang.org/x/sys/unix"
 | 
			
		||||
 | 
			
		||||
import "strings"
 | 
			
		||||
import (
 | 
			
		||||
	"bytes"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"unsafe"
 | 
			
		||||
 | 
			
		||||
	"golang.org/x/sys/internal/unsafeheader"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// ByteSliceFromString returns a NUL-terminated slice of bytes
 | 
			
		||||
// containing the text of s. If s contains a NUL byte at any
 | 
			
		||||
@@ -49,5 +55,40 @@ func BytePtrFromString(s string) (*byte, error) {
 | 
			
		||||
	return &a[0], nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ByteSliceToString returns a string form of the text represented by the slice s, with a terminating NUL and any
 | 
			
		||||
// bytes after the NUL removed.
 | 
			
		||||
func ByteSliceToString(s []byte) string {
 | 
			
		||||
	if i := bytes.IndexByte(s, 0); i != -1 {
 | 
			
		||||
		s = s[:i]
 | 
			
		||||
	}
 | 
			
		||||
	return string(s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// BytePtrToString takes a pointer to a sequence of text and returns the corresponding string.
 | 
			
		||||
// If the pointer is nil, it returns the empty string. It assumes that the text sequence is terminated
 | 
			
		||||
// at a zero byte; if the zero byte is not present, the program may crash.
 | 
			
		||||
func BytePtrToString(p *byte) string {
 | 
			
		||||
	if p == nil {
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
	if *p == 0 {
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Find NUL terminator.
 | 
			
		||||
	n := 0
 | 
			
		||||
	for ptr := unsafe.Pointer(p); *(*byte)(ptr) != 0; n++ {
 | 
			
		||||
		ptr = unsafe.Pointer(uintptr(ptr) + 1)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var s []byte
 | 
			
		||||
	h := (*unsafeheader.Slice)(unsafe.Pointer(&s))
 | 
			
		||||
	h.Data = unsafe.Pointer(p)
 | 
			
		||||
	h.Len = n
 | 
			
		||||
	h.Cap = n
 | 
			
		||||
 | 
			
		||||
	return string(s)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Single-word zero for use when we need a valid pointer to 0 bytes.
 | 
			
		||||
var _zero uintptr
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										16
									
								
								vendor/golang.org/x/sys/unix/syscall_aix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								vendor/golang.org/x/sys/unix/syscall_aix.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -19,6 +19,22 @@ import "unsafe"
 | 
			
		||||
 * Wrapped
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
func Access(path string, mode uint32) (err error) {
 | 
			
		||||
	return Faccessat(AT_FDCWD, path, mode, 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Chmod(path string, mode uint32) (err error) {
 | 
			
		||||
	return Fchmodat(AT_FDCWD, path, mode, 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Chown(path string, uid int, gid int) (err error) {
 | 
			
		||||
	return Fchownat(AT_FDCWD, path, uid, gid, 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Creat(path string, mode uint32) (fd int, err error) {
 | 
			
		||||
	return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	utimes(path string, times *[2]Timeval) (err error)
 | 
			
		||||
func Utimes(path string, tv []Timeval) error {
 | 
			
		||||
	if len(tv) != 2 {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								vendor/golang.org/x/sys/unix/syscall_bsd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								vendor/golang.org/x/sys/unix/syscall_bsd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -18,6 +18,21 @@ import (
 | 
			
		||||
	"unsafe"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const ImplementsGetwd = true
 | 
			
		||||
 | 
			
		||||
func Getwd() (string, error) {
 | 
			
		||||
	var buf [PathMax]byte
 | 
			
		||||
	_, err := Getcwd(buf[0:])
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
	n := clen(buf[:])
 | 
			
		||||
	if n < 1 {
 | 
			
		||||
		return "", EINVAL
 | 
			
		||||
	}
 | 
			
		||||
	return string(buf[:n]), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Wrapped
 | 
			
		||||
 */
 | 
			
		||||
@@ -262,7 +277,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
 | 
			
		||||
		}
 | 
			
		||||
		return sa, nil
 | 
			
		||||
	}
 | 
			
		||||
	return nil, EAFNOSUPPORT
 | 
			
		||||
	return anyToSockaddrGOOS(fd, rsa)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Accept(fd int) (nfd int, sa Sockaddr, err error) {
 | 
			
		||||
@@ -272,7 +287,7 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) {
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if runtime.GOOS == "darwin" && len == 0 {
 | 
			
		||||
	if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && len == 0 {
 | 
			
		||||
		// Accepted socket has no address.
 | 
			
		||||
		// This is likely due to a bug in xnu kernels,
 | 
			
		||||
		// where instead of ECONNABORTED error socket
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -10,6 +10,8 @@ import (
 | 
			
		||||
	"unsafe"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const _SYS_GETDIRENTRIES64 = 344
 | 
			
		||||
 | 
			
		||||
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
 | 
			
		||||
	// To implement this using libSystem we'd need syscall_syscallPtr for
 | 
			
		||||
	// fdopendir. However, syscallPtr was only added in Go 1.13, so we fall
 | 
			
		||||
@@ -20,7 +22,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
 | 
			
		||||
	} else {
 | 
			
		||||
		p = unsafe.Pointer(&_zero)
 | 
			
		||||
	}
 | 
			
		||||
	r0, _, e1 := Syscall6(SYS_GETDIRENTRIES64, uintptr(fd), uintptr(p), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0)
 | 
			
		||||
	r0, _, e1 := Syscall6(_SYS_GETDIRENTRIES64, uintptr(fd), uintptr(p), uintptr(len(buf)), uintptr(unsafe.Pointer(basep)), 0, 0)
 | 
			
		||||
	n = int(r0)
 | 
			
		||||
	if e1 != 0 {
 | 
			
		||||
		return n, errnoErr(e1)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										141
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										141
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -13,29 +13,11 @@
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
	"runtime"
 | 
			
		||||
	"syscall"
 | 
			
		||||
	"unsafe"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const ImplementsGetwd = true
 | 
			
		||||
 | 
			
		||||
func Getwd() (string, error) {
 | 
			
		||||
	buf := make([]byte, 2048)
 | 
			
		||||
	attrs, err := getAttrList(".", attrList{CommonAttr: attrCmnFullpath}, buf, 0)
 | 
			
		||||
	if err == nil && len(attrs) == 1 && len(attrs[0]) >= 2 {
 | 
			
		||||
		wd := string(attrs[0])
 | 
			
		||||
		// Sanity check that it's an absolute path and ends
 | 
			
		||||
		// in a null byte, which we then strip.
 | 
			
		||||
		if wd[0] == '/' && wd[len(wd)-1] == 0 {
 | 
			
		||||
			return wd[:len(wd)-1], nil
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// If pkg/os/getwd.go gets ENOTSUP, it will fall back to the
 | 
			
		||||
	// slow algorithm.
 | 
			
		||||
	return "", ENOTSUP
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets.
 | 
			
		||||
type SockaddrDatalink struct {
 | 
			
		||||
	Len    uint8
 | 
			
		||||
@@ -49,6 +31,41 @@ type SockaddrDatalink struct {
 | 
			
		||||
	raw    RawSockaddrDatalink
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SockaddrCtl implements the Sockaddr interface for AF_SYSTEM type sockets.
 | 
			
		||||
type SockaddrCtl struct {
 | 
			
		||||
	ID   uint32
 | 
			
		||||
	Unit uint32
 | 
			
		||||
	raw  RawSockaddrCtl
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (sa *SockaddrCtl) sockaddr() (unsafe.Pointer, _Socklen, error) {
 | 
			
		||||
	sa.raw.Sc_len = SizeofSockaddrCtl
 | 
			
		||||
	sa.raw.Sc_family = AF_SYSTEM
 | 
			
		||||
	sa.raw.Ss_sysaddr = AF_SYS_CONTROL
 | 
			
		||||
	sa.raw.Sc_id = sa.ID
 | 
			
		||||
	sa.raw.Sc_unit = sa.Unit
 | 
			
		||||
	return unsafe.Pointer(&sa.raw), SizeofSockaddrCtl, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
 | 
			
		||||
	switch rsa.Addr.Family {
 | 
			
		||||
	case AF_SYSTEM:
 | 
			
		||||
		pp := (*RawSockaddrCtl)(unsafe.Pointer(rsa))
 | 
			
		||||
		if pp.Ss_sysaddr == AF_SYS_CONTROL {
 | 
			
		||||
			sa := new(SockaddrCtl)
 | 
			
		||||
			sa.ID = pp.Sc_id
 | 
			
		||||
			sa.Unit = pp.Sc_unit
 | 
			
		||||
			return sa, nil
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return nil, EAFNOSUPPORT
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Some external packages rely on SYS___SYSCTL being defined to implement their
 | 
			
		||||
// own sysctl wrappers. Provide it here, even though direct syscalls are no
 | 
			
		||||
// longer supported on darwin.
 | 
			
		||||
const SYS___SYSCTL = SYS_SYSCTL
 | 
			
		||||
 | 
			
		||||
// Translate "kern.hostname" to []_C_int{0,1,2,3}.
 | 
			
		||||
func nametomib(name string) (mib []_C_int, err error) {
 | 
			
		||||
	const siz = unsafe.Sizeof(mib[0])
 | 
			
		||||
@@ -92,11 +109,6 @@ func direntNamlen(buf []byte) (uint64, bool) {
 | 
			
		||||
func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
 | 
			
		||||
func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
	attrBitMapCount = 5
 | 
			
		||||
	attrCmnFullpath = 0x08000000
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type attrList struct {
 | 
			
		||||
	bitmapCount uint16
 | 
			
		||||
	_           uint16
 | 
			
		||||
@@ -107,54 +119,6 @@ type attrList struct {
 | 
			
		||||
	Forkattr    uint32
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (attrs [][]byte, err error) {
 | 
			
		||||
	if len(attrBuf) < 4 {
 | 
			
		||||
		return nil, errors.New("attrBuf too small")
 | 
			
		||||
	}
 | 
			
		||||
	attrList.bitmapCount = attrBitMapCount
 | 
			
		||||
 | 
			
		||||
	var _p0 *byte
 | 
			
		||||
	_p0, err = BytePtrFromString(path)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := getattrlist(_p0, unsafe.Pointer(&attrList), unsafe.Pointer(&attrBuf[0]), uintptr(len(attrBuf)), int(options)); err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	size := *(*uint32)(unsafe.Pointer(&attrBuf[0]))
 | 
			
		||||
 | 
			
		||||
	// dat is the section of attrBuf that contains valid data,
 | 
			
		||||
	// without the 4 byte length header. All attribute offsets
 | 
			
		||||
	// are relative to dat.
 | 
			
		||||
	dat := attrBuf
 | 
			
		||||
	if int(size) < len(attrBuf) {
 | 
			
		||||
		dat = dat[:size]
 | 
			
		||||
	}
 | 
			
		||||
	dat = dat[4:] // remove length prefix
 | 
			
		||||
 | 
			
		||||
	for i := uint32(0); int(i) < len(dat); {
 | 
			
		||||
		header := dat[i:]
 | 
			
		||||
		if len(header) < 8 {
 | 
			
		||||
			return attrs, errors.New("truncated attribute header")
 | 
			
		||||
		}
 | 
			
		||||
		datOff := *(*int32)(unsafe.Pointer(&header[0]))
 | 
			
		||||
		attrLen := *(*uint32)(unsafe.Pointer(&header[4]))
 | 
			
		||||
		if datOff < 0 || uint32(datOff)+attrLen > uint32(len(dat)) {
 | 
			
		||||
			return attrs, errors.New("truncated results; attrBuf too small")
 | 
			
		||||
		}
 | 
			
		||||
		end := uint32(datOff) + attrLen
 | 
			
		||||
		attrs = append(attrs, dat[datOff:end])
 | 
			
		||||
		i = end
 | 
			
		||||
		if r := i % 4; r != 0 {
 | 
			
		||||
			i += (4 - r)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
 | 
			
		||||
 | 
			
		||||
//sysnb pipe() (r int, w int, err error)
 | 
			
		||||
 | 
			
		||||
func Pipe(p []int) (err error) {
 | 
			
		||||
@@ -324,6 +288,35 @@ func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(sig
 | 
			
		||||
 | 
			
		||||
//sys	ioctl(fd int, req uint, arg uintptr) (err error)
 | 
			
		||||
 | 
			
		||||
func IoctlCtlInfo(fd int, ctlInfo *CtlInfo) error {
 | 
			
		||||
	err := ioctl(fd, CTLIOCGINFO, uintptr(unsafe.Pointer(ctlInfo)))
 | 
			
		||||
	runtime.KeepAlive(ctlInfo)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IfreqMTU is struct ifreq used to get or set a network device's MTU.
 | 
			
		||||
type IfreqMTU struct {
 | 
			
		||||
	Name [IFNAMSIZ]byte
 | 
			
		||||
	MTU  int32
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IoctlGetIfreqMTU performs the SIOCGIFMTU ioctl operation on fd to get the MTU
 | 
			
		||||
// of the network device specified by ifname.
 | 
			
		||||
func IoctlGetIfreqMTU(fd int, ifname string) (*IfreqMTU, error) {
 | 
			
		||||
	var ifreq IfreqMTU
 | 
			
		||||
	copy(ifreq.Name[:], ifname)
 | 
			
		||||
	err := ioctl(fd, SIOCGIFMTU, uintptr(unsafe.Pointer(&ifreq)))
 | 
			
		||||
	return &ifreq, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IoctlSetIfreqMTU performs the SIOCSIFMTU ioctl operation on fd to set the MTU
 | 
			
		||||
// of the network device specified by ifreq.Name.
 | 
			
		||||
func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error {
 | 
			
		||||
	err := ioctl(fd, SIOCSIFMTU, uintptr(unsafe.Pointer(ifreq)))
 | 
			
		||||
	runtime.KeepAlive(ifreq)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys   sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL
 | 
			
		||||
 | 
			
		||||
func Uname(uname *Utsname) error {
 | 
			
		||||
@@ -396,6 +389,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
 | 
			
		||||
//sys	Chroot(path string) (err error)
 | 
			
		||||
//sys	ClockGettime(clockid int32, time *Timespec) (err error)
 | 
			
		||||
//sys	Close(fd int) (err error)
 | 
			
		||||
//sys	Clonefile(src string, dst string, flags int) (err error)
 | 
			
		||||
//sys	Clonefileat(srcDirfd int, src string, dstDirfd int, dst string, flags int) (err error)
 | 
			
		||||
//sys	Dup(fd int) (nfd int, err error)
 | 
			
		||||
//sys	Dup2(from int, to int) (err error)
 | 
			
		||||
//sys	Exchangedata(path1 string, path2 string, options int) (err error)
 | 
			
		||||
@@ -407,10 +402,12 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
 | 
			
		||||
//sys	Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
 | 
			
		||||
//sys	Fchown(fd int, uid int, gid int) (err error)
 | 
			
		||||
//sys	Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
 | 
			
		||||
//sys	Fclonefileat(srcDirfd int, dstDirfd int, dst string, flags int) (err error)
 | 
			
		||||
//sys	Flock(fd int, how int) (err error)
 | 
			
		||||
//sys	Fpathconf(fd int, name int) (val int, err error)
 | 
			
		||||
//sys	Fsync(fd int) (err error)
 | 
			
		||||
//sys	Ftruncate(fd int, length int64) (err error)
 | 
			
		||||
//sys	Getcwd(buf []byte) (n int, err error)
 | 
			
		||||
//sys	Getdtablesize() (size int)
 | 
			
		||||
//sysnb	Getegid() (egid int)
 | 
			
		||||
//sysnb	Geteuid() (uid int)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_386.1_11.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_386.1_11.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,9 +0,0 @@
 | 
			
		||||
// Copyright 2019 The Go Authors. All rights reserved.
 | 
			
		||||
// Use of this source code is governed by a BSD-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
// +build darwin,386,!go1.12
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
//sys  Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
 | 
			
		||||
							
								
								
									
										11
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_386.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_386.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -6,11 +6,7 @@
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"syscall"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
//sys   ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
 | 
			
		||||
import "syscall"
 | 
			
		||||
 | 
			
		||||
func setTimespec(sec, nsec int64) Timespec {
 | 
			
		||||
	return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
 | 
			
		||||
@@ -44,14 +40,11 @@ func (cmsg *Cmsghdr) SetLen(length int) {
 | 
			
		||||
 | 
			
		||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
 | 
			
		||||
 | 
			
		||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
 | 
			
		||||
// of darwin/386 the syscall is called sysctl instead of __sysctl.
 | 
			
		||||
const SYS___SYSCTL = SYS_SYSCTL
 | 
			
		||||
 | 
			
		||||
//sys	Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
 | 
			
		||||
//sys	Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
 | 
			
		||||
//sys	Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
 | 
			
		||||
//sys	getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
 | 
			
		||||
//sys	Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
 | 
			
		||||
//sys	ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
 | 
			
		||||
//sys	Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
 | 
			
		||||
//sys	Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_amd64.1_11.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_amd64.1_11.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,9 +0,0 @@
 | 
			
		||||
// Copyright 2019 The Go Authors. All rights reserved.
 | 
			
		||||
// Use of this source code is governed by a BSD-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
// +build darwin,amd64,!go1.12
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
//sys  Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
 | 
			
		||||
							
								
								
									
										11
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -6,11 +6,7 @@
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"syscall"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
//sys   ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
 | 
			
		||||
import "syscall"
 | 
			
		||||
 | 
			
		||||
func setTimespec(sec, nsec int64) Timespec {
 | 
			
		||||
	return Timespec{Sec: sec, Nsec: nsec}
 | 
			
		||||
@@ -44,14 +40,11 @@ func (cmsg *Cmsghdr) SetLen(length int) {
 | 
			
		||||
 | 
			
		||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
 | 
			
		||||
 | 
			
		||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
 | 
			
		||||
// of darwin/amd64 the syscall is called sysctl instead of __sysctl.
 | 
			
		||||
const SYS___SYSCTL = SYS_SYSCTL
 | 
			
		||||
 | 
			
		||||
//sys	Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
 | 
			
		||||
//sys	Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
 | 
			
		||||
//sys	Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
 | 
			
		||||
//sys	getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
 | 
			
		||||
//sys	Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
 | 
			
		||||
//sys	ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
 | 
			
		||||
//sys	Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
 | 
			
		||||
//sys	Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_arm.1_11.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_arm.1_11.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,11 +0,0 @@
 | 
			
		||||
// Copyright 2019 The Go Authors. All rights reserved.
 | 
			
		||||
// Use of this source code is governed by a BSD-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
// +build darwin,arm,!go1.12
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
 | 
			
		||||
	return 0, ENOSYS
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										8
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -4,9 +4,7 @@
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"syscall"
 | 
			
		||||
)
 | 
			
		||||
import "syscall"
 | 
			
		||||
 | 
			
		||||
func ptrace(request int, pid int, addr uintptr, data uintptr) error {
 | 
			
		||||
	return ENOTSUP
 | 
			
		||||
@@ -44,10 +42,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
 | 
			
		||||
 | 
			
		||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
 | 
			
		||||
 | 
			
		||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
 | 
			
		||||
// of darwin/arm the syscall is called sysctl instead of __sysctl.
 | 
			
		||||
const SYS___SYSCTL = SYS_SYSCTL
 | 
			
		||||
 | 
			
		||||
//sys	Fstat(fd int, stat *Stat_t) (err error)
 | 
			
		||||
//sys	Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
 | 
			
		||||
//sys	Fstatfs(fd int, stat *Statfs_t) (err error)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										11
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_arm64.1_11.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										11
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_arm64.1_11.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -1,11 +0,0 @@
 | 
			
		||||
// Copyright 2019 The Go Authors. All rights reserved.
 | 
			
		||||
// Use of this source code is governed by a BSD-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
// +build darwin,arm64,!go1.12
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
 | 
			
		||||
	return 0, ENOSYS
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										13
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -6,13 +6,7 @@
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"syscall"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func ptrace(request int, pid int, addr uintptr, data uintptr) error {
 | 
			
		||||
	return ENOTSUP
 | 
			
		||||
}
 | 
			
		||||
import "syscall"
 | 
			
		||||
 | 
			
		||||
func setTimespec(sec, nsec int64) Timespec {
 | 
			
		||||
	return Timespec{Sec: sec, Nsec: nsec}
 | 
			
		||||
@@ -46,14 +40,11 @@ func (cmsg *Cmsghdr) SetLen(length int) {
 | 
			
		||||
 | 
			
		||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
 | 
			
		||||
 | 
			
		||||
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
 | 
			
		||||
// of darwin/arm64 the syscall is called sysctl instead of __sysctl.
 | 
			
		||||
const SYS___SYSCTL = SYS_SYSCTL
 | 
			
		||||
 | 
			
		||||
//sys	Fstat(fd int, stat *Stat_t) (err error)
 | 
			
		||||
//sys	Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
 | 
			
		||||
//sys	Fstatfs(fd int, stat *Statfs_t) (err error)
 | 
			
		||||
//sys	getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
 | 
			
		||||
//sys	Lstat(path string, stat *Stat_t) (err error)
 | 
			
		||||
//sys	ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
 | 
			
		||||
//sys	Stat(path string, stat *Stat_t) (err error)
 | 
			
		||||
//sys	Statfs(path string, stat *Statfs_t) (err error)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								vendor/golang.org/x/sys/unix/syscall_dragonfly.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								vendor/golang.org/x/sys/unix/syscall_dragonfly.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -47,6 +47,10 @@ type SockaddrDatalink struct {
 | 
			
		||||
	raw    RawSockaddrDatalink
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
 | 
			
		||||
	return nil, EAFNOSUPPORT
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Translate "kern.hostname" to []_C_int{0,1,2,3}.
 | 
			
		||||
func nametomib(name string) (mib []_C_int, err error) {
 | 
			
		||||
	const siz = unsafe.Sizeof(mib[0])
 | 
			
		||||
@@ -129,23 +133,8 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const ImplementsGetwd = true
 | 
			
		||||
 | 
			
		||||
//sys	Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
 | 
			
		||||
 | 
			
		||||
func Getwd() (string, error) {
 | 
			
		||||
	var buf [PathMax]byte
 | 
			
		||||
	_, err := Getcwd(buf[0:])
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
	n := clen(buf[:])
 | 
			
		||||
	if n < 1 {
 | 
			
		||||
		return "", EINVAL
 | 
			
		||||
	}
 | 
			
		||||
	return string(buf[:n]), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
 | 
			
		||||
	var _p0 unsafe.Pointer
 | 
			
		||||
	var bufsize uintptr
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								vendor/golang.org/x/sys/unix/syscall_freebsd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								vendor/golang.org/x/sys/unix/syscall_freebsd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -54,6 +54,10 @@ type SockaddrDatalink struct {
 | 
			
		||||
	raw    RawSockaddrDatalink
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
 | 
			
		||||
	return nil, EAFNOSUPPORT
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Translate "kern.hostname" to []_C_int{0,1,2,3}.
 | 
			
		||||
func nametomib(name string) (mib []_C_int, err error) {
 | 
			
		||||
	const siz = unsafe.Sizeof(mib[0])
 | 
			
		||||
@@ -140,23 +144,8 @@ func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const ImplementsGetwd = true
 | 
			
		||||
 | 
			
		||||
//sys	Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
 | 
			
		||||
 | 
			
		||||
func Getwd() (string, error) {
 | 
			
		||||
	var buf [PathMax]byte
 | 
			
		||||
	_, err := Getcwd(buf[0:])
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
	n := clen(buf[:])
 | 
			
		||||
	if n < 1 {
 | 
			
		||||
		return "", EINVAL
 | 
			
		||||
	}
 | 
			
		||||
	return string(buf[:n]), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
 | 
			
		||||
	var (
 | 
			
		||||
		_p0          unsafe.Pointer
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										41
									
								
								vendor/golang.org/x/sys/unix/syscall_illumos.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										41
									
								
								vendor/golang.org/x/sys/unix/syscall_illumos.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -24,7 +24,7 @@ func bytes2iovec(bs [][]byte) []Iovec {
 | 
			
		||||
	return iovecs
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys   readv(fd int, iovs []Iovec) (n int, err error)
 | 
			
		||||
//sys	readv(fd int, iovs []Iovec) (n int, err error)
 | 
			
		||||
 | 
			
		||||
func Readv(fd int, iovs [][]byte) (n int, err error) {
 | 
			
		||||
	iovecs := bytes2iovec(iovs)
 | 
			
		||||
@@ -32,7 +32,7 @@ func Readv(fd int, iovs [][]byte) (n int, err error) {
 | 
			
		||||
	return n, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys   preadv(fd int, iovs []Iovec, off int64) (n int, err error)
 | 
			
		||||
//sys	preadv(fd int, iovs []Iovec, off int64) (n int, err error)
 | 
			
		||||
 | 
			
		||||
func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) {
 | 
			
		||||
	iovecs := bytes2iovec(iovs)
 | 
			
		||||
@@ -40,7 +40,7 @@ func Preadv(fd int, iovs [][]byte, off int64) (n int, err error) {
 | 
			
		||||
	return n, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys   writev(fd int, iovs []Iovec) (n int, err error)
 | 
			
		||||
//sys	writev(fd int, iovs []Iovec) (n int, err error)
 | 
			
		||||
 | 
			
		||||
func Writev(fd int, iovs [][]byte) (n int, err error) {
 | 
			
		||||
	iovecs := bytes2iovec(iovs)
 | 
			
		||||
@@ -48,10 +48,43 @@ func Writev(fd int, iovs [][]byte) (n int, err error) {
 | 
			
		||||
	return n, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys   pwritev(fd int, iovs []Iovec, off int64) (n int, err error)
 | 
			
		||||
//sys	pwritev(fd int, iovs []Iovec, off int64) (n int, err error)
 | 
			
		||||
 | 
			
		||||
func Pwritev(fd int, iovs [][]byte, off int64) (n int, err error) {
 | 
			
		||||
	iovecs := bytes2iovec(iovs)
 | 
			
		||||
	n, err = pwritev(fd, iovecs, off)
 | 
			
		||||
	return n, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) = libsocket.accept4
 | 
			
		||||
 | 
			
		||||
func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) {
 | 
			
		||||
	var rsa RawSockaddrAny
 | 
			
		||||
	var len _Socklen = SizeofSockaddrAny
 | 
			
		||||
	nfd, err = accept4(fd, &rsa, &len, flags)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	if len > SizeofSockaddrAny {
 | 
			
		||||
		panic("RawSockaddrAny too small")
 | 
			
		||||
	}
 | 
			
		||||
	sa, err = anyToSockaddr(fd, &rsa)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		Close(nfd)
 | 
			
		||||
		nfd = 0
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sysnb	pipe2(p *[2]_C_int, flags int) (err error)
 | 
			
		||||
 | 
			
		||||
func Pipe2(p []int, flags int) error {
 | 
			
		||||
	if len(p) != 2 {
 | 
			
		||||
		return EINVAL
 | 
			
		||||
	}
 | 
			
		||||
	var pp [2]_C_int
 | 
			
		||||
	err := pipe2(&pp, flags)
 | 
			
		||||
	p[0] = int(pp[0])
 | 
			
		||||
	p[1] = int(pp[1])
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										47
									
								
								vendor/golang.org/x/sys/unix/syscall_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										47
									
								
								vendor/golang.org/x/sys/unix/syscall_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -106,12 +106,53 @@ func IoctlGetRTCTime(fd int) (*RTCTime, error) {
 | 
			
		||||
	return &value, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IoctlGetWatchdogInfo fetches information about a watchdog device from the
 | 
			
		||||
// Linux watchdog API. For more information, see:
 | 
			
		||||
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
 | 
			
		||||
func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) {
 | 
			
		||||
	var value WatchdogInfo
 | 
			
		||||
	err := ioctl(fd, WDIOC_GETSUPPORT, uintptr(unsafe.Pointer(&value)))
 | 
			
		||||
	return &value, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) {
 | 
			
		||||
	var value RTCWkAlrm
 | 
			
		||||
	err := ioctl(fd, RTC_WKALM_RD, uintptr(unsafe.Pointer(&value)))
 | 
			
		||||
	return &value, err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IoctlFileCloneRange performs an FICLONERANGE ioctl operation to clone the
 | 
			
		||||
// range of data conveyed in value to the file associated with the file
 | 
			
		||||
// descriptor destFd. See the ioctl_ficlonerange(2) man page for details.
 | 
			
		||||
func IoctlFileCloneRange(destFd int, value *FileCloneRange) error {
 | 
			
		||||
	err := ioctl(destFd, FICLONERANGE, uintptr(unsafe.Pointer(value)))
 | 
			
		||||
	runtime.KeepAlive(value)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IoctlFileClone performs an FICLONE ioctl operation to clone the entire file
 | 
			
		||||
// associated with the file description srcFd to the file associated with the
 | 
			
		||||
// file descriptor destFd. See the ioctl_ficlone(2) man page for details.
 | 
			
		||||
func IoctlFileClone(destFd, srcFd int) error {
 | 
			
		||||
	return ioctl(destFd, FICLONE, uintptr(srcFd))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IoctlFileDedupeRange performs an FIDEDUPERANGE ioctl operation to share the
 | 
			
		||||
// range of data conveyed in value with the file associated with the file
 | 
			
		||||
// descriptor destFd. See the ioctl_fideduperange(2) man page for details.
 | 
			
		||||
func IoctlFileDedupeRange(destFd int, value *FileDedupeRange) error {
 | 
			
		||||
	err := ioctl(destFd, FIDEDUPERANGE, uintptr(unsafe.Pointer(value)))
 | 
			
		||||
	runtime.KeepAlive(value)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// IoctlWatchdogKeepalive issues a keepalive ioctl to a watchdog device. For
 | 
			
		||||
// more information, see:
 | 
			
		||||
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
 | 
			
		||||
func IoctlWatchdogKeepalive(fd int) error {
 | 
			
		||||
	return ioctl(fd, WDIOC_KEEPALIVE, 0)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
 | 
			
		||||
 | 
			
		||||
func Link(oldpath string, newpath string) (err error) {
 | 
			
		||||
@@ -136,6 +177,12 @@ func Openat(dirfd int, path string, flags int, mode uint32) (fd int, err error)
 | 
			
		||||
	return openat(dirfd, path, flags|O_LARGEFILE, mode)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	openat2(dirfd int, path string, open_how *OpenHow, size int) (fd int, err error)
 | 
			
		||||
 | 
			
		||||
func Openat2(dirfd int, path string, how *OpenHow) (fd int, err error) {
 | 
			
		||||
	return openat2(dirfd, path, how, SizeofOpenHow)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sys	ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
 | 
			
		||||
 | 
			
		||||
func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								vendor/golang.org/x/sys/unix/syscall_linux_386.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/golang.org/x/sys/unix/syscall_linux_386.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -2,9 +2,6 @@
 | 
			
		||||
// Use of this source code is governed by a BSD-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
 | 
			
		||||
// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
 | 
			
		||||
// so that go vet can check that they are correct.
 | 
			
		||||
 | 
			
		||||
// +build 386,linux
 | 
			
		||||
 | 
			
		||||
package unix
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								vendor/golang.org/x/sys/unix/syscall_netbsd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								vendor/golang.org/x/sys/unix/syscall_netbsd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -31,6 +31,10 @@ type SockaddrDatalink struct {
 | 
			
		||||
	raw    RawSockaddrDatalink
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
 | 
			
		||||
	return nil, EAFNOSUPPORT
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
 | 
			
		||||
 | 
			
		||||
func sysctlNodes(mib []_C_int) (nodes []Sysctlnode, err error) {
 | 
			
		||||
@@ -141,23 +145,8 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const ImplementsGetwd = true
 | 
			
		||||
 | 
			
		||||
//sys	Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
 | 
			
		||||
 | 
			
		||||
func Getwd() (string, error) {
 | 
			
		||||
	var buf [PathMax]byte
 | 
			
		||||
	_, err := Getcwd(buf[0:])
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
	n := clen(buf[:])
 | 
			
		||||
	if n < 1 {
 | 
			
		||||
		return "", EINVAL
 | 
			
		||||
	}
 | 
			
		||||
	return string(buf[:n]), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TODO
 | 
			
		||||
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
 | 
			
		||||
	return -1, ENOSYS
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										19
									
								
								vendor/golang.org/x/sys/unix/syscall_openbsd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										19
									
								
								vendor/golang.org/x/sys/unix/syscall_openbsd.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -31,6 +31,10 @@ type SockaddrDatalink struct {
 | 
			
		||||
	raw    RawSockaddrDatalink
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
 | 
			
		||||
	return nil, EAFNOSUPPORT
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
 | 
			
		||||
 | 
			
		||||
func nametomib(name string) (mib []_C_int, err error) {
 | 
			
		||||
@@ -114,23 +118,8 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const ImplementsGetwd = true
 | 
			
		||||
 | 
			
		||||
//sys	Getcwd(buf []byte) (n int, err error) = SYS___GETCWD
 | 
			
		||||
 | 
			
		||||
func Getwd() (string, error) {
 | 
			
		||||
	var buf [PathMax]byte
 | 
			
		||||
	_, err := Getcwd(buf[0:])
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return "", err
 | 
			
		||||
	}
 | 
			
		||||
	n := clen(buf[:])
 | 
			
		||||
	if n < 1 {
 | 
			
		||||
		return "", EINVAL
 | 
			
		||||
	}
 | 
			
		||||
	return string(buf[:n]), nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
 | 
			
		||||
	if raceenabled {
 | 
			
		||||
		raceReleaseMerge(unsafe.Pointer(&ioSync))
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								vendor/golang.org/x/sys/unix/syscall_solaris.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								vendor/golang.org/x/sys/unix/syscall_solaris.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -13,6 +13,7 @@
 | 
			
		||||
package unix
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"runtime"
 | 
			
		||||
	"syscall"
 | 
			
		||||
	"unsafe"
 | 
			
		||||
)
 | 
			
		||||
@@ -553,8 +554,10 @@ func Minor(dev uint64) uint32 {
 | 
			
		||||
 | 
			
		||||
//sys	ioctl(fd int, req uint, arg uintptr) (err error)
 | 
			
		||||
 | 
			
		||||
func IoctlSetTermio(fd int, req uint, value *Termio) (err error) {
 | 
			
		||||
	return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
 | 
			
		||||
func IoctlSetTermio(fd int, req uint, value *Termio) error {
 | 
			
		||||
	err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
 | 
			
		||||
	runtime.KeepAlive(value)
 | 
			
		||||
	return err
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func IoctlGetTermio(fd int, req uint) (*Termio, error) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/golang.org/x/sys/unix/zerrors_darwin_386.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/golang.org/x/sys/unix/zerrors_darwin_386.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -45,6 +45,7 @@ const (
 | 
			
		||||
	AF_SIP                            = 0x18
 | 
			
		||||
	AF_SNA                            = 0xb
 | 
			
		||||
	AF_SYSTEM                         = 0x20
 | 
			
		||||
	AF_SYS_CONTROL                    = 0x2
 | 
			
		||||
	AF_UNIX                           = 0x1
 | 
			
		||||
	AF_UNSPEC                         = 0x0
 | 
			
		||||
	AF_UTUN                           = 0x26
 | 
			
		||||
@@ -232,6 +233,8 @@ const (
 | 
			
		||||
	CLOCK_THREAD_CPUTIME_ID           = 0x10
 | 
			
		||||
	CLOCK_UPTIME_RAW                  = 0x8
 | 
			
		||||
	CLOCK_UPTIME_RAW_APPROX           = 0x9
 | 
			
		||||
	CLONE_NOFOLLOW                    = 0x1
 | 
			
		||||
	CLONE_NOOWNERCOPY                 = 0x2
 | 
			
		||||
	CR0                               = 0x0
 | 
			
		||||
	CR1                               = 0x1000
 | 
			
		||||
	CR2                               = 0x2000
 | 
			
		||||
@@ -249,6 +252,7 @@ const (
 | 
			
		||||
	CSTOP                             = 0x13
 | 
			
		||||
	CSTOPB                            = 0x400
 | 
			
		||||
	CSUSP                             = 0x1a
 | 
			
		||||
	CTLIOCGINFO                       = 0xc0644e03
 | 
			
		||||
	CTL_HW                            = 0x6
 | 
			
		||||
	CTL_KERN                          = 0x1
 | 
			
		||||
	CTL_MAXNAME                       = 0xc
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -45,6 +45,7 @@ const (
 | 
			
		||||
	AF_SIP                            = 0x18
 | 
			
		||||
	AF_SNA                            = 0xb
 | 
			
		||||
	AF_SYSTEM                         = 0x20
 | 
			
		||||
	AF_SYS_CONTROL                    = 0x2
 | 
			
		||||
	AF_UNIX                           = 0x1
 | 
			
		||||
	AF_UNSPEC                         = 0x0
 | 
			
		||||
	AF_UTUN                           = 0x26
 | 
			
		||||
@@ -232,6 +233,8 @@ const (
 | 
			
		||||
	CLOCK_THREAD_CPUTIME_ID           = 0x10
 | 
			
		||||
	CLOCK_UPTIME_RAW                  = 0x8
 | 
			
		||||
	CLOCK_UPTIME_RAW_APPROX           = 0x9
 | 
			
		||||
	CLONE_NOFOLLOW                    = 0x1
 | 
			
		||||
	CLONE_NOOWNERCOPY                 = 0x2
 | 
			
		||||
	CR0                               = 0x0
 | 
			
		||||
	CR1                               = 0x1000
 | 
			
		||||
	CR2                               = 0x2000
 | 
			
		||||
@@ -249,6 +252,7 @@ const (
 | 
			
		||||
	CSTOP                             = 0x13
 | 
			
		||||
	CSTOPB                            = 0x400
 | 
			
		||||
	CSUSP                             = 0x1a
 | 
			
		||||
	CTLIOCGINFO                       = 0xc0644e03
 | 
			
		||||
	CTL_HW                            = 0x6
 | 
			
		||||
	CTL_KERN                          = 0x1
 | 
			
		||||
	CTL_MAXNAME                       = 0xc
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/golang.org/x/sys/unix/zerrors_darwin_arm.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -45,6 +45,7 @@ const (
 | 
			
		||||
	AF_SIP                            = 0x18
 | 
			
		||||
	AF_SNA                            = 0xb
 | 
			
		||||
	AF_SYSTEM                         = 0x20
 | 
			
		||||
	AF_SYS_CONTROL                    = 0x2
 | 
			
		||||
	AF_UNIX                           = 0x1
 | 
			
		||||
	AF_UNSPEC                         = 0x0
 | 
			
		||||
	AF_UTUN                           = 0x26
 | 
			
		||||
@@ -232,6 +233,8 @@ const (
 | 
			
		||||
	CLOCK_THREAD_CPUTIME_ID           = 0x10
 | 
			
		||||
	CLOCK_UPTIME_RAW                  = 0x8
 | 
			
		||||
	CLOCK_UPTIME_RAW_APPROX           = 0x9
 | 
			
		||||
	CLONE_NOFOLLOW                    = 0x1
 | 
			
		||||
	CLONE_NOOWNERCOPY                 = 0x2
 | 
			
		||||
	CR0                               = 0x0
 | 
			
		||||
	CR1                               = 0x1000
 | 
			
		||||
	CR2                               = 0x2000
 | 
			
		||||
@@ -249,6 +252,7 @@ const (
 | 
			
		||||
	CSTOP                             = 0x13
 | 
			
		||||
	CSTOPB                            = 0x400
 | 
			
		||||
	CSUSP                             = 0x1a
 | 
			
		||||
	CTLIOCGINFO                       = 0xc0644e03
 | 
			
		||||
	CTL_HW                            = 0x6
 | 
			
		||||
	CTL_KERN                          = 0x1
 | 
			
		||||
	CTL_MAXNAME                       = 0xc
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -45,6 +45,7 @@ const (
 | 
			
		||||
	AF_SIP                            = 0x18
 | 
			
		||||
	AF_SNA                            = 0xb
 | 
			
		||||
	AF_SYSTEM                         = 0x20
 | 
			
		||||
	AF_SYS_CONTROL                    = 0x2
 | 
			
		||||
	AF_UNIX                           = 0x1
 | 
			
		||||
	AF_UNSPEC                         = 0x0
 | 
			
		||||
	AF_UTUN                           = 0x26
 | 
			
		||||
@@ -232,6 +233,8 @@ const (
 | 
			
		||||
	CLOCK_THREAD_CPUTIME_ID           = 0x10
 | 
			
		||||
	CLOCK_UPTIME_RAW                  = 0x8
 | 
			
		||||
	CLOCK_UPTIME_RAW_APPROX           = 0x9
 | 
			
		||||
	CLONE_NOFOLLOW                    = 0x1
 | 
			
		||||
	CLONE_NOOWNERCOPY                 = 0x2
 | 
			
		||||
	CR0                               = 0x0
 | 
			
		||||
	CR1                               = 0x1000
 | 
			
		||||
	CR2                               = 0x2000
 | 
			
		||||
@@ -249,6 +252,7 @@ const (
 | 
			
		||||
	CSTOP                             = 0x13
 | 
			
		||||
	CSTOPB                            = 0x400
 | 
			
		||||
	CSUSP                             = 0x1a
 | 
			
		||||
	CTLIOCGINFO                       = 0xc0644e03
 | 
			
		||||
	CTL_HW                            = 0x6
 | 
			
		||||
	CTL_KERN                          = 0x1
 | 
			
		||||
	CTL_MAXNAME                       = 0xc
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										138
									
								
								vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										138
									
								
								vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -62,6 +62,7 @@ const (
 | 
			
		||||
	B28800                            = 0x7080
 | 
			
		||||
	B300                              = 0x12c
 | 
			
		||||
	B38400                            = 0x9600
 | 
			
		||||
	B460800                           = 0x70800
 | 
			
		||||
	B4800                             = 0x12c0
 | 
			
		||||
	B50                               = 0x32
 | 
			
		||||
	B57600                            = 0xe100
 | 
			
		||||
@@ -69,12 +70,15 @@ const (
 | 
			
		||||
	B7200                             = 0x1c20
 | 
			
		||||
	B75                               = 0x4b
 | 
			
		||||
	B76800                            = 0x12c00
 | 
			
		||||
	B921600                           = 0xe1000
 | 
			
		||||
	B9600                             = 0x2580
 | 
			
		||||
	BIOCFEEDBACK                      = 0x8004427d
 | 
			
		||||
	BIOCFLUSH                         = 0x20004268
 | 
			
		||||
	BIOCGBLEN                         = 0x40044266
 | 
			
		||||
	BIOCGDLT                          = 0x4004426a
 | 
			
		||||
	BIOCGDLTLIST                      = 0xc0104279
 | 
			
		||||
	BIOCGETIF                         = 0x4020426b
 | 
			
		||||
	BIOCGFEEDBACK                     = 0x4004427c
 | 
			
		||||
	BIOCGHDRCMPLT                     = 0x40044274
 | 
			
		||||
	BIOCGRSIG                         = 0x40044272
 | 
			
		||||
	BIOCGRTIMEOUT                     = 0x4010426e
 | 
			
		||||
@@ -88,6 +92,7 @@ const (
 | 
			
		||||
	BIOCSETF                          = 0x80104267
 | 
			
		||||
	BIOCSETIF                         = 0x8020426c
 | 
			
		||||
	BIOCSETWF                         = 0x8010427b
 | 
			
		||||
	BIOCSFEEDBACK                     = 0x8004427d
 | 
			
		||||
	BIOCSHDRCMPLT                     = 0x80044275
 | 
			
		||||
	BIOCSRSIG                         = 0x80044273
 | 
			
		||||
	BIOCSRTIMEOUT                     = 0x8010426d
 | 
			
		||||
@@ -125,6 +130,7 @@ const (
 | 
			
		||||
	BPF_MINBUFSIZE                    = 0x20
 | 
			
		||||
	BPF_MINOR_VERSION                 = 0x1
 | 
			
		||||
	BPF_MISC                          = 0x7
 | 
			
		||||
	BPF_MOD                           = 0x90
 | 
			
		||||
	BPF_MSH                           = 0xa0
 | 
			
		||||
	BPF_MUL                           = 0x20
 | 
			
		||||
	BPF_NEG                           = 0x80
 | 
			
		||||
@@ -139,6 +145,7 @@ const (
 | 
			
		||||
	BPF_TXA                           = 0x80
 | 
			
		||||
	BPF_W                             = 0x0
 | 
			
		||||
	BPF_X                             = 0x8
 | 
			
		||||
	BPF_XOR                           = 0xa0
 | 
			
		||||
	BRKINT                            = 0x2
 | 
			
		||||
	CFLUSH                            = 0xf
 | 
			
		||||
	CLOCAL                            = 0x8000
 | 
			
		||||
@@ -156,6 +163,12 @@ const (
 | 
			
		||||
	CLOCK_UPTIME_FAST                 = 0x8
 | 
			
		||||
	CLOCK_UPTIME_PRECISE              = 0x7
 | 
			
		||||
	CLOCK_VIRTUAL                     = 0x1
 | 
			
		||||
	CPUSTATES                         = 0x5
 | 
			
		||||
	CP_IDLE                           = 0x4
 | 
			
		||||
	CP_INTR                           = 0x3
 | 
			
		||||
	CP_NICE                           = 0x1
 | 
			
		||||
	CP_SYS                            = 0x2
 | 
			
		||||
	CP_USER                           = 0x0
 | 
			
		||||
	CREAD                             = 0x800
 | 
			
		||||
	CRTSCTS                           = 0x30000
 | 
			
		||||
	CS5                               = 0x0
 | 
			
		||||
@@ -175,6 +188,7 @@ const (
 | 
			
		||||
	DLT_A429                          = 0xb8
 | 
			
		||||
	DLT_A653_ICM                      = 0xb9
 | 
			
		||||
	DLT_AIRONET_HEADER                = 0x78
 | 
			
		||||
	DLT_AOS                           = 0xde
 | 
			
		||||
	DLT_APPLE_IP_OVER_IEEE1394        = 0x8a
 | 
			
		||||
	DLT_ARCNET                        = 0x7
 | 
			
		||||
	DLT_ARCNET_LINUX                  = 0x81
 | 
			
		||||
@@ -184,22 +198,33 @@ const (
 | 
			
		||||
	DLT_AX25                          = 0x3
 | 
			
		||||
	DLT_AX25_KISS                     = 0xca
 | 
			
		||||
	DLT_BACNET_MS_TP                  = 0xa5
 | 
			
		||||
	DLT_BLUETOOTH_BREDR_BB            = 0xff
 | 
			
		||||
	DLT_BLUETOOTH_HCI_H4              = 0xbb
 | 
			
		||||
	DLT_BLUETOOTH_HCI_H4_WITH_PHDR    = 0xc9
 | 
			
		||||
	DLT_BLUETOOTH_LE_LL               = 0xfb
 | 
			
		||||
	DLT_BLUETOOTH_LE_LL_WITH_PHDR     = 0x100
 | 
			
		||||
	DLT_BLUETOOTH_LINUX_MONITOR       = 0xfe
 | 
			
		||||
	DLT_CAN20B                        = 0xbe
 | 
			
		||||
	DLT_CAN_SOCKETCAN                 = 0xe3
 | 
			
		||||
	DLT_CHAOS                         = 0x5
 | 
			
		||||
	DLT_CHDLC                         = 0x68
 | 
			
		||||
	DLT_CISCO_IOS                     = 0x76
 | 
			
		||||
	DLT_C_HDLC                        = 0x68
 | 
			
		||||
	DLT_C_HDLC_WITH_DIR               = 0xcd
 | 
			
		||||
	DLT_DBUS                          = 0xe7
 | 
			
		||||
	DLT_DECT                          = 0xdd
 | 
			
		||||
	DLT_DOCSIS                        = 0x8f
 | 
			
		||||
	DLT_DVB_CI                        = 0xeb
 | 
			
		||||
	DLT_ECONET                        = 0x73
 | 
			
		||||
	DLT_EN10MB                        = 0x1
 | 
			
		||||
	DLT_EN3MB                         = 0x2
 | 
			
		||||
	DLT_ENC                           = 0x6d
 | 
			
		||||
	DLT_EPON                          = 0x103
 | 
			
		||||
	DLT_ERF                           = 0xc5
 | 
			
		||||
	DLT_ERF_ETH                       = 0xaf
 | 
			
		||||
	DLT_ERF_POS                       = 0xb0
 | 
			
		||||
	DLT_FC_2                          = 0xe0
 | 
			
		||||
	DLT_FC_2_WITH_FRAME_DELIMS        = 0xe1
 | 
			
		||||
	DLT_FDDI                          = 0xa
 | 
			
		||||
	DLT_FLEXRAY                       = 0xd2
 | 
			
		||||
	DLT_FRELAY                        = 0x6b
 | 
			
		||||
@@ -209,6 +234,8 @@ const (
 | 
			
		||||
	DLT_GPF_F                         = 0xab
 | 
			
		||||
	DLT_GPF_T                         = 0xaa
 | 
			
		||||
	DLT_GPRS_LLC                      = 0xa9
 | 
			
		||||
	DLT_GSMTAP_ABIS                   = 0xda
 | 
			
		||||
	DLT_GSMTAP_UM                     = 0xd9
 | 
			
		||||
	DLT_HHDLC                         = 0x79
 | 
			
		||||
	DLT_IBM_SN                        = 0x92
 | 
			
		||||
	DLT_IBM_SP                        = 0x91
 | 
			
		||||
@@ -218,18 +245,28 @@ const (
 | 
			
		||||
	DLT_IEEE802_11_RADIO_AVS          = 0xa3
 | 
			
		||||
	DLT_IEEE802_15_4                  = 0xc3
 | 
			
		||||
	DLT_IEEE802_15_4_LINUX            = 0xbf
 | 
			
		||||
	DLT_IEEE802_15_4_NOFCS            = 0xe6
 | 
			
		||||
	DLT_IEEE802_15_4_NONASK_PHY       = 0xd7
 | 
			
		||||
	DLT_IEEE802_16_MAC_CPS            = 0xbc
 | 
			
		||||
	DLT_IEEE802_16_MAC_CPS_RADIO      = 0xc1
 | 
			
		||||
	DLT_INFINIBAND                    = 0xf7
 | 
			
		||||
	DLT_IPFILTER                      = 0x74
 | 
			
		||||
	DLT_IPMB                          = 0xc7
 | 
			
		||||
	DLT_IPMB_LINUX                    = 0xd1
 | 
			
		||||
	DLT_IPMI_HPM_2                    = 0x104
 | 
			
		||||
	DLT_IPNET                         = 0xe2
 | 
			
		||||
	DLT_IPOIB                         = 0xf2
 | 
			
		||||
	DLT_IPV4                          = 0xe4
 | 
			
		||||
	DLT_IPV6                          = 0xe5
 | 
			
		||||
	DLT_IP_OVER_FC                    = 0x7a
 | 
			
		||||
	DLT_ISO_14443                     = 0x108
 | 
			
		||||
	DLT_JUNIPER_ATM1                  = 0x89
 | 
			
		||||
	DLT_JUNIPER_ATM2                  = 0x87
 | 
			
		||||
	DLT_JUNIPER_ATM_CEMIC             = 0xee
 | 
			
		||||
	DLT_JUNIPER_CHDLC                 = 0xb5
 | 
			
		||||
	DLT_JUNIPER_ES                    = 0x84
 | 
			
		||||
	DLT_JUNIPER_ETHER                 = 0xb2
 | 
			
		||||
	DLT_JUNIPER_FIBRECHANNEL          = 0xea
 | 
			
		||||
	DLT_JUNIPER_FRELAY                = 0xb4
 | 
			
		||||
	DLT_JUNIPER_GGSN                  = 0x85
 | 
			
		||||
	DLT_JUNIPER_ISM                   = 0xc2
 | 
			
		||||
@@ -242,25 +279,40 @@ const (
 | 
			
		||||
	DLT_JUNIPER_PPPOE                 = 0xa7
 | 
			
		||||
	DLT_JUNIPER_PPPOE_ATM             = 0xa8
 | 
			
		||||
	DLT_JUNIPER_SERVICES              = 0x88
 | 
			
		||||
	DLT_JUNIPER_SRX_E2E               = 0xe9
 | 
			
		||||
	DLT_JUNIPER_ST                    = 0xc8
 | 
			
		||||
	DLT_JUNIPER_VP                    = 0xb7
 | 
			
		||||
	DLT_JUNIPER_VS                    = 0xe8
 | 
			
		||||
	DLT_LAPB_WITH_DIR                 = 0xcf
 | 
			
		||||
	DLT_LAPD                          = 0xcb
 | 
			
		||||
	DLT_LIN                           = 0xd4
 | 
			
		||||
	DLT_LINUX_EVDEV                   = 0xd8
 | 
			
		||||
	DLT_LINUX_IRDA                    = 0x90
 | 
			
		||||
	DLT_LINUX_LAPD                    = 0xb1
 | 
			
		||||
	DLT_LINUX_SLL                     = 0x71
 | 
			
		||||
	DLT_LOOP                          = 0x6c
 | 
			
		||||
	DLT_LTALK                         = 0x72
 | 
			
		||||
	DLT_MATCHING_MAX                  = 0x109
 | 
			
		||||
	DLT_MATCHING_MIN                  = 0x68
 | 
			
		||||
	DLT_MFR                           = 0xb6
 | 
			
		||||
	DLT_MOST                          = 0xd3
 | 
			
		||||
	DLT_MPEG_2_TS                     = 0xf3
 | 
			
		||||
	DLT_MPLS                          = 0xdb
 | 
			
		||||
	DLT_MTP2                          = 0x8c
 | 
			
		||||
	DLT_MTP2_WITH_PHDR                = 0x8b
 | 
			
		||||
	DLT_MTP3                          = 0x8d
 | 
			
		||||
	DLT_MUX27010                      = 0xec
 | 
			
		||||
	DLT_NETANALYZER                   = 0xf0
 | 
			
		||||
	DLT_NETANALYZER_TRANSPARENT       = 0xf1
 | 
			
		||||
	DLT_NETLINK                       = 0xfd
 | 
			
		||||
	DLT_NFC_LLCP                      = 0xf5
 | 
			
		||||
	DLT_NFLOG                         = 0xef
 | 
			
		||||
	DLT_NG40                          = 0xf4
 | 
			
		||||
	DLT_NULL                          = 0x0
 | 
			
		||||
	DLT_PCI_EXP                       = 0x7d
 | 
			
		||||
	DLT_PFLOG                         = 0x75
 | 
			
		||||
	DLT_PFSYNC                        = 0x12
 | 
			
		||||
	DLT_PKTAP                         = 0x102
 | 
			
		||||
	DLT_PPI                           = 0xc0
 | 
			
		||||
	DLT_PPP                           = 0x9
 | 
			
		||||
	DLT_PPP_BSDOS                     = 0x10
 | 
			
		||||
@@ -269,22 +321,51 @@ const (
 | 
			
		||||
	DLT_PPP_SERIAL                    = 0x32
 | 
			
		||||
	DLT_PPP_WITH_DIR                  = 0xcc
 | 
			
		||||
	DLT_PRISM_HEADER                  = 0x77
 | 
			
		||||
	DLT_PROFIBUS_DL                   = 0x101
 | 
			
		||||
	DLT_PRONET                        = 0x4
 | 
			
		||||
	DLT_RAIF1                         = 0xc6
 | 
			
		||||
	DLT_RAW                           = 0xc
 | 
			
		||||
	DLT_RDS                           = 0x109
 | 
			
		||||
	DLT_REDBACK_SMARTEDGE             = 0x20
 | 
			
		||||
	DLT_RIO                           = 0x7c
 | 
			
		||||
	DLT_RTAC_SERIAL                   = 0xfa
 | 
			
		||||
	DLT_SCCP                          = 0x8e
 | 
			
		||||
	DLT_SCTP                          = 0xf8
 | 
			
		||||
	DLT_SITA                          = 0xc4
 | 
			
		||||
	DLT_SLIP                          = 0x8
 | 
			
		||||
	DLT_SLIP_BSDOS                    = 0xf
 | 
			
		||||
	DLT_STANAG_5066_D_PDU             = 0xed
 | 
			
		||||
	DLT_SUNATM                        = 0x7b
 | 
			
		||||
	DLT_SYMANTEC_FIREWALL             = 0x63
 | 
			
		||||
	DLT_TZSP                          = 0x80
 | 
			
		||||
	DLT_USB                           = 0xba
 | 
			
		||||
	DLT_USBPCAP                       = 0xf9
 | 
			
		||||
	DLT_USB_FREEBSD                   = 0xba
 | 
			
		||||
	DLT_USB_LINUX                     = 0xbd
 | 
			
		||||
	DLT_USB_LINUX_MMAPPED             = 0xdc
 | 
			
		||||
	DLT_USER0                         = 0x93
 | 
			
		||||
	DLT_USER1                         = 0x94
 | 
			
		||||
	DLT_USER10                        = 0x9d
 | 
			
		||||
	DLT_USER11                        = 0x9e
 | 
			
		||||
	DLT_USER12                        = 0x9f
 | 
			
		||||
	DLT_USER13                        = 0xa0
 | 
			
		||||
	DLT_USER14                        = 0xa1
 | 
			
		||||
	DLT_USER15                        = 0xa2
 | 
			
		||||
	DLT_USER2                         = 0x95
 | 
			
		||||
	DLT_USER3                         = 0x96
 | 
			
		||||
	DLT_USER4                         = 0x97
 | 
			
		||||
	DLT_USER5                         = 0x98
 | 
			
		||||
	DLT_USER6                         = 0x99
 | 
			
		||||
	DLT_USER7                         = 0x9a
 | 
			
		||||
	DLT_USER8                         = 0x9b
 | 
			
		||||
	DLT_USER9                         = 0x9c
 | 
			
		||||
	DLT_WATTSTOPPER_DLM               = 0x107
 | 
			
		||||
	DLT_WIHART                        = 0xdf
 | 
			
		||||
	DLT_WIRESHARK_UPPER_PDU           = 0xfc
 | 
			
		||||
	DLT_X2E_SERIAL                    = 0xd5
 | 
			
		||||
	DLT_X2E_XORAYA                    = 0xd6
 | 
			
		||||
	DLT_ZWAVE_R1_R2                   = 0x105
 | 
			
		||||
	DLT_ZWAVE_R3                      = 0x106
 | 
			
		||||
	DT_BLK                            = 0x6
 | 
			
		||||
	DT_CHR                            = 0x2
 | 
			
		||||
	DT_DBF                            = 0xf
 | 
			
		||||
@@ -323,10 +404,11 @@ const (
 | 
			
		||||
	EV_EOF                            = 0x8000
 | 
			
		||||
	EV_ERROR                          = 0x4000
 | 
			
		||||
	EV_FLAG1                          = 0x2000
 | 
			
		||||
	EV_HUP                            = 0x800
 | 
			
		||||
	EV_NODATA                         = 0x1000
 | 
			
		||||
	EV_ONESHOT                        = 0x10
 | 
			
		||||
	EV_RECEIPT                        = 0x40
 | 
			
		||||
	EV_SYSFLAGS                       = 0xf000
 | 
			
		||||
	EV_SYSFLAGS                       = 0xf800
 | 
			
		||||
	EXTA                              = 0x4b00
 | 
			
		||||
	EXTB                              = 0x9600
 | 
			
		||||
	EXTEXIT_LWP                       = 0x10000
 | 
			
		||||
@@ -365,8 +447,9 @@ const (
 | 
			
		||||
	IFF_ALLMULTI                      = 0x200
 | 
			
		||||
	IFF_ALTPHYS                       = 0x4000
 | 
			
		||||
	IFF_BROADCAST                     = 0x2
 | 
			
		||||
	IFF_CANTCHANGE                    = 0x118e72
 | 
			
		||||
	IFF_CANTCHANGE                    = 0x318e72
 | 
			
		||||
	IFF_DEBUG                         = 0x4
 | 
			
		||||
	IFF_IDIRECT                       = 0x200000
 | 
			
		||||
	IFF_LINK0                         = 0x1000
 | 
			
		||||
	IFF_LINK1                         = 0x2000
 | 
			
		||||
	IFF_LINK2                         = 0x4000
 | 
			
		||||
@@ -441,7 +524,6 @@ const (
 | 
			
		||||
	IFT_EPLRS                         = 0x57
 | 
			
		||||
	IFT_ESCON                         = 0x49
 | 
			
		||||
	IFT_ETHER                         = 0x6
 | 
			
		||||
	IFT_FAITH                         = 0xf2
 | 
			
		||||
	IFT_FAST                          = 0x7d
 | 
			
		||||
	IFT_FASTETHER                     = 0x3e
 | 
			
		||||
	IFT_FASTETHERFX                   = 0x45
 | 
			
		||||
@@ -614,6 +696,7 @@ const (
 | 
			
		||||
	IN_CLASSD_NET                     = 0xf0000000
 | 
			
		||||
	IN_CLASSD_NSHIFT                  = 0x1c
 | 
			
		||||
	IN_LOOPBACKNET                    = 0x7f
 | 
			
		||||
	IN_RFC3021_MASK                   = 0xfffffffe
 | 
			
		||||
	IPPROTO_3PC                       = 0x22
 | 
			
		||||
	IPPROTO_ADFS                      = 0x44
 | 
			
		||||
	IPPROTO_AH                        = 0x33
 | 
			
		||||
@@ -735,7 +818,6 @@ const (
 | 
			
		||||
	IPV6_DEFHLIM                      = 0x40
 | 
			
		||||
	IPV6_DONTFRAG                     = 0x3e
 | 
			
		||||
	IPV6_DSTOPTS                      = 0x32
 | 
			
		||||
	IPV6_FAITH                        = 0x1d
 | 
			
		||||
	IPV6_FLOWINFO_MASK                = 0xffffff0f
 | 
			
		||||
	IPV6_FLOWLABEL_MASK               = 0xffff0f00
 | 
			
		||||
	IPV6_FRAGTTL                      = 0x78
 | 
			
		||||
@@ -747,7 +829,6 @@ const (
 | 
			
		||||
	IPV6_HLIMDEC                      = 0x1
 | 
			
		||||
	IPV6_HOPLIMIT                     = 0x2f
 | 
			
		||||
	IPV6_HOPOPTS                      = 0x31
 | 
			
		||||
	IPV6_IPSEC_POLICY                 = 0x1c
 | 
			
		||||
	IPV6_JOIN_GROUP                   = 0xc
 | 
			
		||||
	IPV6_LEAVE_GROUP                  = 0xd
 | 
			
		||||
	IPV6_MAXHLIM                      = 0xff
 | 
			
		||||
@@ -795,16 +876,22 @@ const (
 | 
			
		||||
	IP_DUMMYNET_DEL                   = 0x3d
 | 
			
		||||
	IP_DUMMYNET_FLUSH                 = 0x3e
 | 
			
		||||
	IP_DUMMYNET_GET                   = 0x40
 | 
			
		||||
	IP_FAITH                          = 0x16
 | 
			
		||||
	IP_FW_ADD                         = 0x32
 | 
			
		||||
	IP_FW_DEL                         = 0x33
 | 
			
		||||
	IP_FW_FLUSH                       = 0x34
 | 
			
		||||
	IP_FW_GET                         = 0x36
 | 
			
		||||
	IP_FW_RESETLOG                    = 0x37
 | 
			
		||||
	IP_FW_TBL_ADD                     = 0x2a
 | 
			
		||||
	IP_FW_TBL_CREATE                  = 0x28
 | 
			
		||||
	IP_FW_TBL_DEL                     = 0x2b
 | 
			
		||||
	IP_FW_TBL_DESTROY                 = 0x29
 | 
			
		||||
	IP_FW_TBL_EXPIRE                  = 0x2f
 | 
			
		||||
	IP_FW_TBL_FLUSH                   = 0x2c
 | 
			
		||||
	IP_FW_TBL_GET                     = 0x2d
 | 
			
		||||
	IP_FW_TBL_ZERO                    = 0x2e
 | 
			
		||||
	IP_FW_X                           = 0x31
 | 
			
		||||
	IP_FW_ZERO                        = 0x35
 | 
			
		||||
	IP_HDRINCL                        = 0x2
 | 
			
		||||
	IP_IPSEC_POLICY                   = 0x15
 | 
			
		||||
	IP_MAXPACKET                      = 0xffff
 | 
			
		||||
	IP_MAX_MEMBERSHIPS                = 0x14
 | 
			
		||||
	IP_MF                             = 0x2000
 | 
			
		||||
@@ -1080,12 +1167,10 @@ const (
 | 
			
		||||
	RTM_MISS                          = 0x7
 | 
			
		||||
	RTM_NEWADDR                       = 0xc
 | 
			
		||||
	RTM_NEWMADDR                      = 0xf
 | 
			
		||||
	RTM_OLDADD                        = 0x9
 | 
			
		||||
	RTM_OLDDEL                        = 0xa
 | 
			
		||||
	RTM_REDIRECT                      = 0x6
 | 
			
		||||
	RTM_RESOLVE                       = 0xb
 | 
			
		||||
	RTM_RTTUNIT                       = 0xf4240
 | 
			
		||||
	RTM_VERSION                       = 0x6
 | 
			
		||||
	RTM_VERSION                       = 0x7
 | 
			
		||||
	RTV_EXPIRE                        = 0x4
 | 
			
		||||
	RTV_HOPCOUNT                      = 0x2
 | 
			
		||||
	RTV_IWCAPSEGS                     = 0x400
 | 
			
		||||
@@ -1106,13 +1191,13 @@ const (
 | 
			
		||||
	SHUT_RDWR                         = 0x2
 | 
			
		||||
	SHUT_WR                           = 0x1
 | 
			
		||||
	SIOCADDMULTI                      = 0x80206931
 | 
			
		||||
	SIOCADDRT                         = 0x8040720a
 | 
			
		||||
	SIOCAIFADDR                       = 0x8040691a
 | 
			
		||||
	SIOCAIFGROUP                      = 0x80286987
 | 
			
		||||
	SIOCALIFADDR                      = 0x8118691b
 | 
			
		||||
	SIOCATMARK                        = 0x40047307
 | 
			
		||||
	SIOCDELMULTI                      = 0x80206932
 | 
			
		||||
	SIOCDELRT                         = 0x8040720b
 | 
			
		||||
	SIOCDIFADDR                       = 0x80206919
 | 
			
		||||
	SIOCDIFGROUP                      = 0x80286989
 | 
			
		||||
	SIOCDIFPHYADDR                    = 0x80206949
 | 
			
		||||
	SIOCDLIFADDR                      = 0x8118691d
 | 
			
		||||
	SIOCGDRVSPEC                      = 0xc028697b
 | 
			
		||||
@@ -1120,6 +1205,7 @@ const (
 | 
			
		||||
	SIOCGETVIFCNT                     = 0xc028720f
 | 
			
		||||
	SIOCGHIWAT                        = 0x40047301
 | 
			
		||||
	SIOCGIFADDR                       = 0xc0206921
 | 
			
		||||
	SIOCGIFALIAS                      = 0xc0406929
 | 
			
		||||
	SIOCGIFBRDADDR                    = 0xc0206923
 | 
			
		||||
	SIOCGIFCAP                        = 0xc020691f
 | 
			
		||||
	SIOCGIFCONF                       = 0xc0106924
 | 
			
		||||
@@ -1128,6 +1214,7 @@ const (
 | 
			
		||||
	SIOCGIFFLAGS                      = 0xc0206911
 | 
			
		||||
	SIOCGIFGENERIC                    = 0xc020693a
 | 
			
		||||
	SIOCGIFGMEMB                      = 0xc028698a
 | 
			
		||||
	SIOCGIFGROUP                      = 0xc0286988
 | 
			
		||||
	SIOCGIFINDEX                      = 0xc0206920
 | 
			
		||||
	SIOCGIFMEDIA                      = 0xc0306938
 | 
			
		||||
	SIOCGIFMETRIC                     = 0xc0206917
 | 
			
		||||
@@ -1194,6 +1281,7 @@ const (
 | 
			
		||||
	SO_RCVBUF                         = 0x1002
 | 
			
		||||
	SO_RCVLOWAT                       = 0x1004
 | 
			
		||||
	SO_RCVTIMEO                       = 0x1006
 | 
			
		||||
	SO_RERROR                         = 0x2000
 | 
			
		||||
	SO_REUSEADDR                      = 0x4
 | 
			
		||||
	SO_REUSEPORT                      = 0x200
 | 
			
		||||
	SO_SNDBUF                         = 0x1001
 | 
			
		||||
@@ -1233,6 +1321,9 @@ const (
 | 
			
		||||
	S_IXGRP                           = 0x8
 | 
			
		||||
	S_IXOTH                           = 0x1
 | 
			
		||||
	S_IXUSR                           = 0x40
 | 
			
		||||
	TAB0                              = 0x0
 | 
			
		||||
	TAB3                              = 0x4
 | 
			
		||||
	TABDLY                            = 0x4
 | 
			
		||||
	TCIFLUSH                          = 0x1
 | 
			
		||||
	TCIOFF                            = 0x3
 | 
			
		||||
	TCIOFLUSH                         = 0x3
 | 
			
		||||
@@ -1259,6 +1350,8 @@ const (
 | 
			
		||||
	TCP_NOPUSH                        = 0x4
 | 
			
		||||
	TCP_SIGNATURE_ENABLE              = 0x10
 | 
			
		||||
	TCSAFLUSH                         = 0x2
 | 
			
		||||
	TIMER_ABSTIME                     = 0x1
 | 
			
		||||
	TIMER_RELTIME                     = 0x0
 | 
			
		||||
	TIOCCBRK                          = 0x2000747a
 | 
			
		||||
	TIOCCDTR                          = 0x20007478
 | 
			
		||||
	TIOCCONS                          = 0x80047462
 | 
			
		||||
@@ -1272,7 +1365,6 @@ const (
 | 
			
		||||
	TIOCGETD                          = 0x4004741a
 | 
			
		||||
	TIOCGPGRP                         = 0x40047477
 | 
			
		||||
	TIOCGSID                          = 0x40047463
 | 
			
		||||
	TIOCGSIZE                         = 0x40087468
 | 
			
		||||
	TIOCGWINSZ                        = 0x40087468
 | 
			
		||||
	TIOCISPTMASTER                    = 0x20007455
 | 
			
		||||
	TIOCMBIC                          = 0x8004746b
 | 
			
		||||
@@ -1317,7 +1409,6 @@ const (
 | 
			
		||||
	TIOCSETD                          = 0x8004741b
 | 
			
		||||
	TIOCSIG                           = 0x2000745f
 | 
			
		||||
	TIOCSPGRP                         = 0x80047476
 | 
			
		||||
	TIOCSSIZE                         = 0x80087467
 | 
			
		||||
	TIOCSTART                         = 0x2000746e
 | 
			
		||||
	TIOCSTAT                          = 0x20007465
 | 
			
		||||
	TIOCSTI                           = 0x80017472
 | 
			
		||||
@@ -1326,6 +1417,8 @@ const (
 | 
			
		||||
	TIOCTIMESTAMP                     = 0x40107459
 | 
			
		||||
	TIOCUCNTL                         = 0x80047466
 | 
			
		||||
	TOSTOP                            = 0x400000
 | 
			
		||||
	UTIME_NOW                         = -0x1
 | 
			
		||||
	UTIME_OMIT                        = -0x2
 | 
			
		||||
	VCHECKPT                          = 0x13
 | 
			
		||||
	VDISCARD                          = 0xf
 | 
			
		||||
	VDSUSP                            = 0xb
 | 
			
		||||
@@ -1350,9 +1443,12 @@ const (
 | 
			
		||||
	VWERASE                           = 0x4
 | 
			
		||||
	WCONTINUED                        = 0x4
 | 
			
		||||
	WCOREFLAG                         = 0x80
 | 
			
		||||
	WEXITED                           = 0x10
 | 
			
		||||
	WLINUXCLONE                       = 0x80000000
 | 
			
		||||
	WNOHANG                           = 0x1
 | 
			
		||||
	WSTOPPED                          = 0x7f
 | 
			
		||||
	WNOWAIT                           = 0x8
 | 
			
		||||
	WSTOPPED                          = 0x2
 | 
			
		||||
	WTRAPPED                          = 0x20
 | 
			
		||||
	WUNTRACED                         = 0x2
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -1452,11 +1548,6 @@ const (
 | 
			
		||||
	ETIMEDOUT       = syscall.Errno(0x3c)
 | 
			
		||||
	ETOOMANYREFS    = syscall.Errno(0x3b)
 | 
			
		||||
	ETXTBSY         = syscall.Errno(0x1a)
 | 
			
		||||
	EUNUSED94       = syscall.Errno(0x5e)
 | 
			
		||||
	EUNUSED95       = syscall.Errno(0x5f)
 | 
			
		||||
	EUNUSED96       = syscall.Errno(0x60)
 | 
			
		||||
	EUNUSED97       = syscall.Errno(0x61)
 | 
			
		||||
	EUNUSED98       = syscall.Errno(0x62)
 | 
			
		||||
	EUSERS          = syscall.Errno(0x44)
 | 
			
		||||
	EWOULDBLOCK     = syscall.Errno(0x23)
 | 
			
		||||
	EXDEV           = syscall.Errno(0x12)
 | 
			
		||||
@@ -1600,12 +1691,7 @@ var errorList = [...]struct {
 | 
			
		||||
	{91, "ENOLINK", "link has been severed"},
 | 
			
		||||
	{92, "EPROTO", "protocol error"},
 | 
			
		||||
	{93, "ENOMEDIUM", "no medium found"},
 | 
			
		||||
	{94, "EUNUSED94", "unknown error: 94"},
 | 
			
		||||
	{95, "EUNUSED95", "unknown error: 95"},
 | 
			
		||||
	{96, "EUNUSED96", "unknown error: 96"},
 | 
			
		||||
	{97, "EUNUSED97", "unknown error: 97"},
 | 
			
		||||
	{98, "EUNUSED98", "unknown error: 98"},
 | 
			
		||||
	{99, "ELAST", "unknown error: 99"},
 | 
			
		||||
	{99, "EASYNC", "unknown error: 99"},
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Signal table
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										173
									
								
								vendor/golang.org/x/sys/unix/zerrors_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										173
									
								
								vendor/golang.org/x/sys/unix/zerrors_linux.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -244,8 +244,66 @@ const (
 | 
			
		||||
	CAN_EFF_FLAG                                = 0x80000000
 | 
			
		||||
	CAN_EFF_ID_BITS                             = 0x1d
 | 
			
		||||
	CAN_EFF_MASK                                = 0x1fffffff
 | 
			
		||||
	CAN_ERR_ACK                                 = 0x20
 | 
			
		||||
	CAN_ERR_BUSERROR                            = 0x80
 | 
			
		||||
	CAN_ERR_BUSOFF                              = 0x40
 | 
			
		||||
	CAN_ERR_CRTL                                = 0x4
 | 
			
		||||
	CAN_ERR_CRTL_ACTIVE                         = 0x40
 | 
			
		||||
	CAN_ERR_CRTL_RX_OVERFLOW                    = 0x1
 | 
			
		||||
	CAN_ERR_CRTL_RX_PASSIVE                     = 0x10
 | 
			
		||||
	CAN_ERR_CRTL_RX_WARNING                     = 0x4
 | 
			
		||||
	CAN_ERR_CRTL_TX_OVERFLOW                    = 0x2
 | 
			
		||||
	CAN_ERR_CRTL_TX_PASSIVE                     = 0x20
 | 
			
		||||
	CAN_ERR_CRTL_TX_WARNING                     = 0x8
 | 
			
		||||
	CAN_ERR_CRTL_UNSPEC                         = 0x0
 | 
			
		||||
	CAN_ERR_DLC                                 = 0x8
 | 
			
		||||
	CAN_ERR_FLAG                                = 0x20000000
 | 
			
		||||
	CAN_ERR_LOSTARB                             = 0x2
 | 
			
		||||
	CAN_ERR_LOSTARB_UNSPEC                      = 0x0
 | 
			
		||||
	CAN_ERR_MASK                                = 0x1fffffff
 | 
			
		||||
	CAN_ERR_PROT                                = 0x8
 | 
			
		||||
	CAN_ERR_PROT_ACTIVE                         = 0x40
 | 
			
		||||
	CAN_ERR_PROT_BIT                            = 0x1
 | 
			
		||||
	CAN_ERR_PROT_BIT0                           = 0x8
 | 
			
		||||
	CAN_ERR_PROT_BIT1                           = 0x10
 | 
			
		||||
	CAN_ERR_PROT_FORM                           = 0x2
 | 
			
		||||
	CAN_ERR_PROT_LOC_ACK                        = 0x19
 | 
			
		||||
	CAN_ERR_PROT_LOC_ACK_DEL                    = 0x1b
 | 
			
		||||
	CAN_ERR_PROT_LOC_CRC_DEL                    = 0x18
 | 
			
		||||
	CAN_ERR_PROT_LOC_CRC_SEQ                    = 0x8
 | 
			
		||||
	CAN_ERR_PROT_LOC_DATA                       = 0xa
 | 
			
		||||
	CAN_ERR_PROT_LOC_DLC                        = 0xb
 | 
			
		||||
	CAN_ERR_PROT_LOC_EOF                        = 0x1a
 | 
			
		||||
	CAN_ERR_PROT_LOC_ID04_00                    = 0xe
 | 
			
		||||
	CAN_ERR_PROT_LOC_ID12_05                    = 0xf
 | 
			
		||||
	CAN_ERR_PROT_LOC_ID17_13                    = 0x7
 | 
			
		||||
	CAN_ERR_PROT_LOC_ID20_18                    = 0x6
 | 
			
		||||
	CAN_ERR_PROT_LOC_ID28_21                    = 0x2
 | 
			
		||||
	CAN_ERR_PROT_LOC_IDE                        = 0x5
 | 
			
		||||
	CAN_ERR_PROT_LOC_INTERM                     = 0x12
 | 
			
		||||
	CAN_ERR_PROT_LOC_RES0                       = 0x9
 | 
			
		||||
	CAN_ERR_PROT_LOC_RES1                       = 0xd
 | 
			
		||||
	CAN_ERR_PROT_LOC_RTR                        = 0xc
 | 
			
		||||
	CAN_ERR_PROT_LOC_SOF                        = 0x3
 | 
			
		||||
	CAN_ERR_PROT_LOC_SRTR                       = 0x4
 | 
			
		||||
	CAN_ERR_PROT_LOC_UNSPEC                     = 0x0
 | 
			
		||||
	CAN_ERR_PROT_OVERLOAD                       = 0x20
 | 
			
		||||
	CAN_ERR_PROT_STUFF                          = 0x4
 | 
			
		||||
	CAN_ERR_PROT_TX                             = 0x80
 | 
			
		||||
	CAN_ERR_PROT_UNSPEC                         = 0x0
 | 
			
		||||
	CAN_ERR_RESTARTED                           = 0x100
 | 
			
		||||
	CAN_ERR_TRX                                 = 0x10
 | 
			
		||||
	CAN_ERR_TRX_CANH_NO_WIRE                    = 0x4
 | 
			
		||||
	CAN_ERR_TRX_CANH_SHORT_TO_BAT               = 0x5
 | 
			
		||||
	CAN_ERR_TRX_CANH_SHORT_TO_GND               = 0x7
 | 
			
		||||
	CAN_ERR_TRX_CANH_SHORT_TO_VCC               = 0x6
 | 
			
		||||
	CAN_ERR_TRX_CANL_NO_WIRE                    = 0x40
 | 
			
		||||
	CAN_ERR_TRX_CANL_SHORT_TO_BAT               = 0x50
 | 
			
		||||
	CAN_ERR_TRX_CANL_SHORT_TO_CANH              = 0x80
 | 
			
		||||
	CAN_ERR_TRX_CANL_SHORT_TO_GND               = 0x70
 | 
			
		||||
	CAN_ERR_TRX_CANL_SHORT_TO_VCC               = 0x60
 | 
			
		||||
	CAN_ERR_TRX_UNSPEC                          = 0x0
 | 
			
		||||
	CAN_ERR_TX_TIMEOUT                          = 0x1
 | 
			
		||||
	CAN_INV_FILTER                              = 0x20000000
 | 
			
		||||
	CAN_ISOTP                                   = 0x6
 | 
			
		||||
	CAN_J1939                                   = 0x7
 | 
			
		||||
@@ -266,6 +324,7 @@ const (
 | 
			
		||||
	CAP_AUDIT_WRITE                             = 0x1d
 | 
			
		||||
	CAP_BLOCK_SUSPEND                           = 0x24
 | 
			
		||||
	CAP_BPF                                     = 0x27
 | 
			
		||||
	CAP_CHECKPOINT_RESTORE                      = 0x28
 | 
			
		||||
	CAP_CHOWN                                   = 0x0
 | 
			
		||||
	CAP_DAC_OVERRIDE                            = 0x1
 | 
			
		||||
	CAP_DAC_READ_SEARCH                         = 0x2
 | 
			
		||||
@@ -274,7 +333,7 @@ const (
 | 
			
		||||
	CAP_IPC_LOCK                                = 0xe
 | 
			
		||||
	CAP_IPC_OWNER                               = 0xf
 | 
			
		||||
	CAP_KILL                                    = 0x5
 | 
			
		||||
	CAP_LAST_CAP                                = 0x27
 | 
			
		||||
	CAP_LAST_CAP                                = 0x28
 | 
			
		||||
	CAP_LEASE                                   = 0x1c
 | 
			
		||||
	CAP_LINUX_IMMUTABLE                         = 0x9
 | 
			
		||||
	CAP_MAC_ADMIN                               = 0x21
 | 
			
		||||
@@ -592,8 +651,8 @@ const (
 | 
			
		||||
	FAN_DELETE                                  = 0x200
 | 
			
		||||
	FAN_DELETE_SELF                             = 0x400
 | 
			
		||||
	FAN_DENY                                    = 0x2
 | 
			
		||||
	FAN_DIR_MODIFY                              = 0x80000
 | 
			
		||||
	FAN_ENABLE_AUDIT                            = 0x40
 | 
			
		||||
	FAN_EVENT_INFO_TYPE_DFID                    = 0x3
 | 
			
		||||
	FAN_EVENT_INFO_TYPE_DFID_NAME               = 0x2
 | 
			
		||||
	FAN_EVENT_INFO_TYPE_FID                     = 0x1
 | 
			
		||||
	FAN_EVENT_METADATA_LEN                      = 0x18
 | 
			
		||||
@@ -621,13 +680,17 @@ const (
 | 
			
		||||
	FAN_OPEN_EXEC_PERM                          = 0x40000
 | 
			
		||||
	FAN_OPEN_PERM                               = 0x10000
 | 
			
		||||
	FAN_Q_OVERFLOW                              = 0x4000
 | 
			
		||||
	FAN_REPORT_DFID_NAME                        = 0xc00
 | 
			
		||||
	FAN_REPORT_DIR_FID                          = 0x400
 | 
			
		||||
	FAN_REPORT_FID                              = 0x200
 | 
			
		||||
	FAN_REPORT_NAME                             = 0x800
 | 
			
		||||
	FAN_REPORT_TID                              = 0x100
 | 
			
		||||
	FAN_UNLIMITED_MARKS                         = 0x20
 | 
			
		||||
	FAN_UNLIMITED_QUEUE                         = 0x10
 | 
			
		||||
	FD_CLOEXEC                                  = 0x1
 | 
			
		||||
	FD_SETSIZE                                  = 0x400
 | 
			
		||||
	FF0                                         = 0x0
 | 
			
		||||
	FIDEDUPERANGE                               = 0xc0189436
 | 
			
		||||
	FSCRYPT_KEY_DESCRIPTOR_SIZE                 = 0x8
 | 
			
		||||
	FSCRYPT_KEY_DESC_PREFIX                     = "fscrypt:"
 | 
			
		||||
	FSCRYPT_KEY_DESC_PREFIX_SIZE                = 0x8
 | 
			
		||||
@@ -1449,6 +1512,92 @@ const (
 | 
			
		||||
	PARITY_DEFAULT                              = 0x0
 | 
			
		||||
	PARITY_NONE                                 = 0x1
 | 
			
		||||
	PARMRK                                      = 0x8
 | 
			
		||||
	PERF_ATTR_SIZE_VER0                         = 0x40
 | 
			
		||||
	PERF_ATTR_SIZE_VER1                         = 0x48
 | 
			
		||||
	PERF_ATTR_SIZE_VER2                         = 0x50
 | 
			
		||||
	PERF_ATTR_SIZE_VER3                         = 0x60
 | 
			
		||||
	PERF_ATTR_SIZE_VER4                         = 0x68
 | 
			
		||||
	PERF_ATTR_SIZE_VER5                         = 0x70
 | 
			
		||||
	PERF_ATTR_SIZE_VER6                         = 0x78
 | 
			
		||||
	PERF_AUX_FLAG_COLLISION                     = 0x8
 | 
			
		||||
	PERF_AUX_FLAG_OVERWRITE                     = 0x2
 | 
			
		||||
	PERF_AUX_FLAG_PARTIAL                       = 0x4
 | 
			
		||||
	PERF_AUX_FLAG_TRUNCATED                     = 0x1
 | 
			
		||||
	PERF_FLAG_FD_CLOEXEC                        = 0x8
 | 
			
		||||
	PERF_FLAG_FD_NO_GROUP                       = 0x1
 | 
			
		||||
	PERF_FLAG_FD_OUTPUT                         = 0x2
 | 
			
		||||
	PERF_FLAG_PID_CGROUP                        = 0x4
 | 
			
		||||
	PERF_MAX_CONTEXTS_PER_STACK                 = 0x8
 | 
			
		||||
	PERF_MAX_STACK_DEPTH                        = 0x7f
 | 
			
		||||
	PERF_MEM_LOCK_LOCKED                        = 0x2
 | 
			
		||||
	PERF_MEM_LOCK_NA                            = 0x1
 | 
			
		||||
	PERF_MEM_LOCK_SHIFT                         = 0x18
 | 
			
		||||
	PERF_MEM_LVLNUM_ANY_CACHE                   = 0xb
 | 
			
		||||
	PERF_MEM_LVLNUM_L1                          = 0x1
 | 
			
		||||
	PERF_MEM_LVLNUM_L2                          = 0x2
 | 
			
		||||
	PERF_MEM_LVLNUM_L3                          = 0x3
 | 
			
		||||
	PERF_MEM_LVLNUM_L4                          = 0x4
 | 
			
		||||
	PERF_MEM_LVLNUM_LFB                         = 0xc
 | 
			
		||||
	PERF_MEM_LVLNUM_NA                          = 0xf
 | 
			
		||||
	PERF_MEM_LVLNUM_PMEM                        = 0xe
 | 
			
		||||
	PERF_MEM_LVLNUM_RAM                         = 0xd
 | 
			
		||||
	PERF_MEM_LVLNUM_SHIFT                       = 0x21
 | 
			
		||||
	PERF_MEM_LVL_HIT                            = 0x2
 | 
			
		||||
	PERF_MEM_LVL_IO                             = 0x1000
 | 
			
		||||
	PERF_MEM_LVL_L1                             = 0x8
 | 
			
		||||
	PERF_MEM_LVL_L2                             = 0x20
 | 
			
		||||
	PERF_MEM_LVL_L3                             = 0x40
 | 
			
		||||
	PERF_MEM_LVL_LFB                            = 0x10
 | 
			
		||||
	PERF_MEM_LVL_LOC_RAM                        = 0x80
 | 
			
		||||
	PERF_MEM_LVL_MISS                           = 0x4
 | 
			
		||||
	PERF_MEM_LVL_NA                             = 0x1
 | 
			
		||||
	PERF_MEM_LVL_REM_CCE1                       = 0x400
 | 
			
		||||
	PERF_MEM_LVL_REM_CCE2                       = 0x800
 | 
			
		||||
	PERF_MEM_LVL_REM_RAM1                       = 0x100
 | 
			
		||||
	PERF_MEM_LVL_REM_RAM2                       = 0x200
 | 
			
		||||
	PERF_MEM_LVL_SHIFT                          = 0x5
 | 
			
		||||
	PERF_MEM_LVL_UNC                            = 0x2000
 | 
			
		||||
	PERF_MEM_OP_EXEC                            = 0x10
 | 
			
		||||
	PERF_MEM_OP_LOAD                            = 0x2
 | 
			
		||||
	PERF_MEM_OP_NA                              = 0x1
 | 
			
		||||
	PERF_MEM_OP_PFETCH                          = 0x8
 | 
			
		||||
	PERF_MEM_OP_SHIFT                           = 0x0
 | 
			
		||||
	PERF_MEM_OP_STORE                           = 0x4
 | 
			
		||||
	PERF_MEM_REMOTE_REMOTE                      = 0x1
 | 
			
		||||
	PERF_MEM_REMOTE_SHIFT                       = 0x25
 | 
			
		||||
	PERF_MEM_SNOOPX_FWD                         = 0x1
 | 
			
		||||
	PERF_MEM_SNOOPX_SHIFT                       = 0x25
 | 
			
		||||
	PERF_MEM_SNOOP_HIT                          = 0x4
 | 
			
		||||
	PERF_MEM_SNOOP_HITM                         = 0x10
 | 
			
		||||
	PERF_MEM_SNOOP_MISS                         = 0x8
 | 
			
		||||
	PERF_MEM_SNOOP_NA                           = 0x1
 | 
			
		||||
	PERF_MEM_SNOOP_NONE                         = 0x2
 | 
			
		||||
	PERF_MEM_SNOOP_SHIFT                        = 0x13
 | 
			
		||||
	PERF_MEM_TLB_HIT                            = 0x2
 | 
			
		||||
	PERF_MEM_TLB_L1                             = 0x8
 | 
			
		||||
	PERF_MEM_TLB_L2                             = 0x10
 | 
			
		||||
	PERF_MEM_TLB_MISS                           = 0x4
 | 
			
		||||
	PERF_MEM_TLB_NA                             = 0x1
 | 
			
		||||
	PERF_MEM_TLB_OS                             = 0x40
 | 
			
		||||
	PERF_MEM_TLB_SHIFT                          = 0x1a
 | 
			
		||||
	PERF_MEM_TLB_WK                             = 0x20
 | 
			
		||||
	PERF_RECORD_KSYMBOL_FLAGS_UNREGISTER        = 0x1
 | 
			
		||||
	PERF_RECORD_MISC_COMM_EXEC                  = 0x2000
 | 
			
		||||
	PERF_RECORD_MISC_CPUMODE_MASK               = 0x7
 | 
			
		||||
	PERF_RECORD_MISC_CPUMODE_UNKNOWN            = 0x0
 | 
			
		||||
	PERF_RECORD_MISC_EXACT_IP                   = 0x4000
 | 
			
		||||
	PERF_RECORD_MISC_EXT_RESERVED               = 0x8000
 | 
			
		||||
	PERF_RECORD_MISC_FORK_EXEC                  = 0x2000
 | 
			
		||||
	PERF_RECORD_MISC_GUEST_KERNEL               = 0x4
 | 
			
		||||
	PERF_RECORD_MISC_GUEST_USER                 = 0x5
 | 
			
		||||
	PERF_RECORD_MISC_HYPERVISOR                 = 0x3
 | 
			
		||||
	PERF_RECORD_MISC_KERNEL                     = 0x1
 | 
			
		||||
	PERF_RECORD_MISC_MMAP_DATA                  = 0x2000
 | 
			
		||||
	PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT     = 0x1000
 | 
			
		||||
	PERF_RECORD_MISC_SWITCH_OUT                 = 0x2000
 | 
			
		||||
	PERF_RECORD_MISC_SWITCH_OUT_PREEMPT         = 0x4000
 | 
			
		||||
	PERF_RECORD_MISC_USER                       = 0x2
 | 
			
		||||
	PERF_SAMPLE_BRANCH_PLM_ALL                  = 0x7
 | 
			
		||||
	PIPEFS_MAGIC                                = 0x50495045
 | 
			
		||||
	PPC_CMM_MAGIC                               = 0xc7571590
 | 
			
		||||
	PPPIOCGNPMODE                               = 0xc008744c
 | 
			
		||||
@@ -1835,6 +1984,7 @@ const (
 | 
			
		||||
	RTPROT_EIGRP                                = 0xc0
 | 
			
		||||
	RTPROT_GATED                                = 0x8
 | 
			
		||||
	RTPROT_ISIS                                 = 0xbb
 | 
			
		||||
	RTPROT_KEEPALIVED                           = 0x12
 | 
			
		||||
	RTPROT_KERNEL                               = 0x2
 | 
			
		||||
	RTPROT_MROUTED                              = 0x11
 | 
			
		||||
	RTPROT_MRT                                  = 0xa
 | 
			
		||||
@@ -1985,6 +2135,7 @@ const (
 | 
			
		||||
	SOL_ATM                                     = 0x108
 | 
			
		||||
	SOL_CAIF                                    = 0x116
 | 
			
		||||
	SOL_CAN_BASE                                = 0x64
 | 
			
		||||
	SOL_CAN_RAW                                 = 0x65
 | 
			
		||||
	SOL_DCCP                                    = 0x10d
 | 
			
		||||
	SOL_DECNET                                  = 0x105
 | 
			
		||||
	SOL_ICMPV6                                  = 0x3a
 | 
			
		||||
@@ -2024,6 +2175,7 @@ const (
 | 
			
		||||
	SO_EE_ORIGIN_TXSTATUS                       = 0x4
 | 
			
		||||
	SO_EE_ORIGIN_TXTIME                         = 0x6
 | 
			
		||||
	SO_EE_ORIGIN_ZEROCOPY                       = 0x5
 | 
			
		||||
	SO_EE_RFC4884_FLAG_INVALID                  = 0x1
 | 
			
		||||
	SO_GET_FILTER                               = 0x1a
 | 
			
		||||
	SO_NO_CHECK                                 = 0xb
 | 
			
		||||
	SO_PEERNAME                                 = 0x1c
 | 
			
		||||
@@ -2297,6 +2449,23 @@ const (
 | 
			
		||||
	WCONTINUED                                  = 0x8
 | 
			
		||||
	WDIOC_SETPRETIMEOUT                         = 0xc0045708
 | 
			
		||||
	WDIOC_SETTIMEOUT                            = 0xc0045706
 | 
			
		||||
	WDIOF_ALARMONLY                             = 0x400
 | 
			
		||||
	WDIOF_CARDRESET                             = 0x20
 | 
			
		||||
	WDIOF_EXTERN1                               = 0x4
 | 
			
		||||
	WDIOF_EXTERN2                               = 0x8
 | 
			
		||||
	WDIOF_FANFAULT                              = 0x2
 | 
			
		||||
	WDIOF_KEEPALIVEPING                         = 0x8000
 | 
			
		||||
	WDIOF_MAGICCLOSE                            = 0x100
 | 
			
		||||
	WDIOF_OVERHEAT                              = 0x1
 | 
			
		||||
	WDIOF_POWEROVER                             = 0x40
 | 
			
		||||
	WDIOF_POWERUNDER                            = 0x10
 | 
			
		||||
	WDIOF_PRETIMEOUT                            = 0x200
 | 
			
		||||
	WDIOF_SETTIMEOUT                            = 0x80
 | 
			
		||||
	WDIOF_UNKNOWN                               = -0x1
 | 
			
		||||
	WDIOS_DISABLECARD                           = 0x1
 | 
			
		||||
	WDIOS_ENABLECARD                            = 0x2
 | 
			
		||||
	WDIOS_TEMPPANIC                             = 0x4
 | 
			
		||||
	WDIOS_UNKNOWN                               = -0x1
 | 
			
		||||
	WEXITED                                     = 0x4
 | 
			
		||||
	WIN_ACKMEDIACHANGE                          = 0xdb
 | 
			
		||||
	WIN_CHECKPOWERMODE1                         = 0xe5
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/golang.org/x/sys/unix/zerrors_linux_386.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/golang.org/x/sys/unix/zerrors_linux_386.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -71,6 +71,8 @@ const (
 | 
			
		||||
	EXTPROC                          = 0x10000
 | 
			
		||||
	FF1                              = 0x8000
 | 
			
		||||
	FFDLY                            = 0x8000
 | 
			
		||||
	FICLONE                          = 0x40049409
 | 
			
		||||
	FICLONERANGE                     = 0x4020940d
 | 
			
		||||
	FLUSHO                           = 0x1000
 | 
			
		||||
	FP_XSTATE_MAGIC2                 = 0x46505845
 | 
			
		||||
	FS_IOC_ENABLE_VERITY             = 0x40806685
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -71,6 +71,8 @@ const (
 | 
			
		||||
	EXTPROC                          = 0x10000
 | 
			
		||||
	FF1                              = 0x8000
 | 
			
		||||
	FFDLY                            = 0x8000
 | 
			
		||||
	FICLONE                          = 0x40049409
 | 
			
		||||
	FICLONERANGE                     = 0x4020940d
 | 
			
		||||
	FLUSHO                           = 0x1000
 | 
			
		||||
	FP_XSTATE_MAGIC2                 = 0x46505845
 | 
			
		||||
	FS_IOC_ENABLE_VERITY             = 0x40806685
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user