From 1b2c1462a8b3534a4aae2501142f1892cce32dfe Mon Sep 17 00:00:00 2001 From: Matt Brittan Date: Sat, 6 Jan 2024 16:16:18 +1300 Subject: [PATCH 1/3] paho `Client.ClientConfig` is now private Users could previously access/change the ClientConfig held by `paho.Client`; this invited race conditions (`paho.Client` could use values from the config at any time and no locking mechanism was provided). To avoid this, the config is now private and examples etc have been updated. A getter for `ClientID` has been added (as this was needed in examples); I suspect additional getters may be of benefit (but will await feedback for that). This may break some users code (but that is probably a good thing) --- autopaho/auto.go | 2 +- paho/client.go | 151 ++++++++++++++++++++----------------- paho/client_test.go | 48 ++++++------ paho/extensions/rpc/rpc.go | 6 +- paho/packet_ids_test.go | 4 +- 5 files changed, 111 insertions(+), 100 deletions(-) diff --git a/autopaho/auto.go b/autopaho/auto.go index 5325b6a..3061797 100644 --- a/autopaho/auto.go +++ b/autopaho/auto.go @@ -448,7 +448,7 @@ func (c *ConnectionManager) PublishViaQueue(ctx context.Context, p *QueuePublish func (c *ConnectionManager) TerminateConnectionForTest() { c.mu.Lock() if c.cli != nil { - _ = c.cli.Conn.Close() + c.cli.TerminateConnectionForTest() } c.mu.Unlock() } diff --git a/paho/client.go b/paho/client.go index eee37e9..94b3ae9 100644 --- a/paho/client.go +++ b/paho/client.go @@ -94,8 +94,8 @@ type ( } // Client is the struct representing an MQTT client Client struct { - mu sync.Mutex - ClientConfig + mu sync.Mutex + config ClientConfig // OnPublishReceived copy of OnPublishReceived from ClientConfig (perhaps with added callback form Router) onPublishReceived []func(PublishReceived) (bool, error) @@ -155,26 +155,26 @@ func NewClient(conf ClientConfig) *Client { MaximumPacketSize: 0, TopicAliasMaximum: 0, }, - ClientConfig: conf, + config: conf, onPublishReceived: conf.OnPublishReceived, done: make(chan struct{}), errors: log.NOOPLogger{}, debug: log.NOOPLogger{}, } - if c.Session == nil { - c.Session = state.NewInMemory() - c.autoCloseSession = true // We created `Session`, so need to close it when done (so handlers all return) + if c.config.Session == nil { + c.config.Session = state.NewInMemory() + c.config.autoCloseSession = true // We created `Session`, so need to close it when done (so handlers all return) } - if c.PacketTimeout == 0 { - c.PacketTimeout = 10 * time.Second + if c.config.PacketTimeout == 0 { + c.config.PacketTimeout = 10 * time.Second } - if c.Router == nil && len(c.onPublishReceived) == 0 { - c.Router = NewStandardRouter() // Maintain backwards compatibility (for now!) + if c.config.Router == nil && len(c.onPublishReceived) == 0 { + c.config.Router = NewStandardRouter() // Maintain backwards compatibility (for now!) } - if c.Router != nil { - r := c.Router + if c.config.Router != nil { + r := c.config.Router c.onPublishReceived = append(c.onPublishReceived, func(p PublishReceived) (bool, error) { r.Route(p.Packet.Packet()) @@ -183,13 +183,13 @@ func NewClient(conf ClientConfig) *Client { } c.onPublishReceivedTracker = make([]int, len(c.onPublishReceived)) // Must have the same number of elements as onPublishReceived - if c.PingHandler == nil { - c.PingHandler = DefaultPingerWithCustomFailHandler(func(e error) { + if c.config.PingHandler == nil { + c.config.PingHandler = DefaultPingerWithCustomFailHandler(func(e error) { go c.error(e) }) } - if c.OnClientError == nil { - c.OnClientError = func(e error) {} + if c.config.OnClientError == nil { + c.config.OnClientError = func(e error) {} } return c @@ -203,14 +203,14 @@ func NewClient(conf ClientConfig) *Client { // returned. Otherwise, the failure Connack (if there is one) is returned // along with an error indicating the reason for the failure to connect. func (c *Client) Connect(ctx context.Context, cp *Connect) (*Connack, error) { - if c.Conn == nil { + if c.config.Conn == nil { return nil, fmt.Errorf("client connection is nil") } cleanup := func() { close(c.stop) close(c.publishPackets) - _ = c.Conn.Close() + _ = c.config.Conn.Close() close(c.done) c.mu.Unlock() } @@ -226,7 +226,7 @@ func (c *Client) Connect(ctx context.Context, cp *Connect) (*Connack, error) { c.publishPackets = make(chan *packets.Publish, publishPacketsSize) keepalive := cp.KeepAlive - c.ClientID = cp.ClientID + c.config.ClientID = cp.ClientID if cp.Properties != nil { if cp.Properties.MaximumPacketSize != nil { c.clientProps.MaximumPacketSize = *cp.Properties.MaximumPacketSize @@ -243,7 +243,7 @@ func (c *Client) Connect(ctx context.Context, cp *Connect) (*Connack, error) { } c.debug.Println("connecting") - connCtx, cf := context.WithTimeout(ctx, c.PacketTimeout) + connCtx, cf := context.WithTimeout(ctx, c.config.PacketTimeout) defer cf() ccp := cp.Packet() @@ -251,7 +251,7 @@ func (c *Client) Connect(ctx context.Context, cp *Connect) (*Connack, error) { ccp.ProtocolVersion = 5 c.debug.Println("sending CONNECT") - if _, err := ccp.WriteTo(c.Conn); err != nil { + if _, err := ccp.WriteTo(c.config.Conn); err != nil { cleanup() return nil, err } @@ -292,7 +292,7 @@ func (c *Client) Connect(ctx context.Context, cp *Connect) (*Connack, error) { return ca, fmt.Errorf("failed to connect to server: %s", reason) } - if err := c.Session.ConAckReceived(c.Conn, ccp, caPacket); err != nil { + if err := c.config.Session.ConAckReceived(c.config.Conn, ccp, caPacket); err != nil { cleanup() return ca, fmt.Errorf("session error: %w", err) } @@ -305,7 +305,7 @@ func (c *Client) Connect(ctx context.Context, cp *Connect) (*Connack, error) { keepalive = *ca.Properties.ServerKeepAlive } if ca.Properties.AssignedClientID != "" { - c.ClientID = ca.Properties.AssignedClientID + c.config.ClientID = ca.Properties.AssignedClientID } if ca.Properties.ReceiveMaximum != nil { c.serverProps.ReceiveMaximum = *ca.Properties.ReceiveMaximum @@ -331,7 +331,7 @@ func (c *Client) Connect(ctx context.Context, cp *Connect) (*Connack, error) { go func() { defer c.workers.Done() defer c.debug.Println("returning from ping handler worker") - c.PingHandler.Start(c.Conn, time.Duration(keepalive)*time.Second) + c.config.PingHandler.Start(c.config.Conn, time.Duration(keepalive)*time.Second) }() } @@ -353,13 +353,13 @@ func (c *Client) Connect(ctx context.Context, cp *Connect) (*Connack, error) { c.incoming() }() - if c.EnableManualAcknowledgment { + if c.config.EnableManualAcknowledgment { c.debug.Println("starting acking routine") c.acksTracker.reset() sendAcksInterval := defaultSendAckInterval - if c.SendAcksInterval > 0 { - sendAcksInterval = c.SendAcksInterval + if c.config.SendAcksInterval > 0 { + sendAcksInterval = c.config.SendAcksInterval } c.workers.Add(1) @@ -395,7 +395,7 @@ func (c *Client) Done() <-chan struct{} { // WARNING: Calling Ack after the connection is closed may have unpredictable results (particularly if the sessionState // is being accessed by a new connection). See issue #160. func (c *Client) Ack(pb *Publish) error { - if !c.EnableManualAcknowledgment { + if !c.config.EnableManualAcknowledgment { return ErrManualAcknowledgmentDisabled } if pb.QoS == 0 { @@ -406,7 +406,7 @@ func (c *Client) Ack(pb *Publish) error { // ack acknowledges a message (note: called by acksTracker to ensure these are sent in order) func (c *Client) ack(pb *packets.Publish) { - c.Session.Ack(pb) + c.config.Session.Ack(pb) } func (c *Client) routePublishPackets() { @@ -419,7 +419,7 @@ func (c *Client) routePublishPackets() { } c.onPublishReceivedMu.Unlock() - if c.ClientConfig.EnableManualAcknowledgment && pb.QoS != 0 { + if c.config.EnableManualAcknowledgment && pb.QoS != 0 { c.acksTracker.add(pb) } @@ -439,7 +439,7 @@ func (c *Client) routePublishPackets() { errs = append(errs, err) } - if !c.ClientConfig.EnableManualAcknowledgment { + if !c.config.EnableManualAcknowledgment { c.ack(pb) } } @@ -460,7 +460,7 @@ func (c *Client) incoming() { case <-c.stop: return default: - recv, err := packets.ReadPacket(c.Conn) + recv, err := packets.ReadPacket(c.config.Conn) if err != nil { go c.error(err) return @@ -475,15 +475,15 @@ func (c *Client) incoming() { ap := recv.Content.(*packets.Auth) switch ap.ReasonCode { case packets.AuthSuccess: - if c.AuthHandler != nil { - go c.AuthHandler.Authenticated() + if c.config.AuthHandler != nil { + go c.config.AuthHandler.Authenticated() } if c.authResponse != nil { c.authResponse <- *recv } case packets.AuthContinueAuthentication: - if c.AuthHandler != nil { - if _, err := c.AuthHandler.Authenticate(AuthFromPacketAuth(ap)).Packet().WriteTo(c.Conn); err != nil { + if c.config.AuthHandler != nil { + if _, err := c.config.AuthHandler.Authenticate(AuthFromPacketAuth(ap)).Packet().WriteTo(c.config.Conn); err != nil { go c.error(err) return } @@ -492,7 +492,7 @@ func (c *Client) incoming() { case packets.PUBLISH: pb := recv.Content.(*packets.Publish) if pb.QoS > 0 { // QOS1 or 2 need to be recorded in session state - c.Session.PacketReceived(recv, c.publishPackets) + c.config.Session.PacketReceived(recv, c.publishPackets) } else { c.debug.Printf("received QoS%d PUBLISH", pb.QoS) c.mu.Lock() @@ -506,16 +506,16 @@ func (c *Client) incoming() { } } case packets.PUBACK, packets.PUBCOMP, packets.SUBACK, packets.UNSUBACK, packets.PUBREC, packets.PUBREL: - c.Session.PacketReceived(recv, c.publishPackets) + c.config.Session.PacketReceived(recv, c.publishPackets) case packets.DISCONNECT: pd := recv.Content.(*packets.Disconnect) c.debug.Println("received DISCONNECT") if c.authResponse != nil { c.authResponse <- *recv } - c.Session.ConnectionLost(pd) // this may impact the session state + c.config.Session.ConnectionLost(pd) // this may impact the session state go func() { - if c.OnServerDisconnect != nil { + if c.config.OnServerDisconnect != nil { go c.serverDisconnect(DisconnectFromPacketDisconnect(pd)) } else { go c.error(fmt.Errorf("server initiated disconnect")) @@ -524,7 +524,7 @@ func (c *Client) incoming() { return case packets.PINGRESP: c.debug.Println("received PINGRESP") - c.PingHandler.PingResp() + c.config.PingHandler.PingResp() } } } @@ -545,15 +545,15 @@ func (c *Client) close() { close(c.stop) c.debug.Println("client stopped") - c.PingHandler.Stop() + c.config.PingHandler.Stop() c.debug.Println("ping stopped") - _ = c.Conn.Close() + _ = c.config.Conn.Close() c.debug.Println("conn closed") c.acksTracker.reset() c.debug.Println("acks tracker reset") - c.Session.ConnectionLost(nil) - if c.autoCloseSession { - if err := c.Session.Close(); err != nil { + c.config.Session.ConnectionLost(nil) + if c.config.autoCloseSession { + if err := c.config.Session.Close(); err != nil { c.errors.Println("error closing session", err) } } @@ -570,13 +570,13 @@ func (c *Client) close() { func (c *Client) error(e error) { c.debug.Println("error called:", e) c.close() - go c.OnClientError(e) + go c.config.OnClientError(e) } func (c *Client) serverDisconnect(d *Disconnect) { c.close() c.debug.Println("calling OnServerDisconnect") - go c.OnServerDisconnect(d) + go c.config.OnServerDisconnect(d) } // Authenticate is used to initiate a reauthentication of credentials with the @@ -601,7 +601,7 @@ func (c *Client) Authenticate(ctx context.Context, a *Auth) (*AuthResponse, erro }() c.debug.Println("sending AUTH") - if _, err := a.Packet().WriteTo(c.Conn); err != nil { + if _, err := a.Packet().WriteTo(c.config.Conn); err != nil { return nil, err } @@ -654,19 +654,19 @@ func (c *Client) Subscribe(ctx context.Context, s *Subscribe) (*Suback, error) { ret := make(chan packets.ControlPacket, 1) sp := s.Packet() - if err := c.Session.AddToSession(ctx, sp, ret); err != nil { + if err := c.config.Session.AddToSession(ctx, sp, ret); err != nil { return nil, err } // From this point on the message is in store, and ret will receive something regardless of whether we succeed in // writing the packet to the connection or not. - if _, err := sp.WriteTo(c.Conn); err != nil { + if _, err := sp.WriteTo(c.config.Conn); err != nil { // The packet will remain in the session state until `Session` is notified of the disconnection. return nil, err } c.debug.Println("waiting for SUBACK") - subCtx, cf := context.WithTimeout(ctx, c.PacketTimeout) + subCtx, cf := context.WithTimeout(ctx, c.config.PacketTimeout) defer cf() var sap packets.ControlPacket @@ -718,18 +718,18 @@ func (c *Client) Unsubscribe(ctx context.Context, u *Unsubscribe) (*Unsuback, er c.debug.Printf("unsubscribing from %+v", u.Topics) ret := make(chan packets.ControlPacket, 1) up := u.Packet() - if err := c.Session.AddToSession(ctx, up, ret); err != nil { + if err := c.config.Session.AddToSession(ctx, up, ret); err != nil { return nil, err } // From this point on the message is in store, and ret will receive something regardless of whether we succeed in // writing the packet to the connection or not - if _, err := up.WriteTo(c.Conn); err != nil { + if _, err := up.WriteTo(c.config.Conn); err != nil { // The packet will remain in the session state until `Session` is notified of the disconnection. return nil, err } - unsubCtx, cf := context.WithTimeout(ctx, c.PacketTimeout) + unsubCtx, cf := context.WithTimeout(ctx, c.config.PacketTimeout) defer cf() var uap packets.ControlPacket @@ -819,8 +819,8 @@ func (c *Client) PublishWithOptions(ctx context.Context, p *Publish, o PublishOp return nil, fmt.Errorf("cannot send a publish with no TopicAlias and no Topic set") } - if c.ClientConfig.PublishHook != nil { - c.ClientConfig.PublishHook(p) + if c.config.PublishHook != nil { + c.config.PublishHook(p) } c.debug.Printf("sending message to %s", p.Topic) @@ -830,7 +830,7 @@ func (c *Client) PublishWithOptions(ctx context.Context, p *Publish, o PublishOp switch p.QoS { case 0: c.debug.Println("sending QoS0 message") - if _, err := pb.WriteTo(c.Conn); err != nil { + if _, err := pb.WriteTo(c.config.Conn); err != nil { go c.error(err) return nil, err } @@ -844,17 +844,17 @@ func (c *Client) PublishWithOptions(ctx context.Context, p *Publish, o PublishOp func (c *Client) publishQoS12(ctx context.Context, pb *packets.Publish, o PublishOptions) (*PublishResponse, error) { c.debug.Println("sending QoS12 message") - pubCtx, cf := context.WithTimeout(ctx, c.PacketTimeout) + pubCtx, cf := context.WithTimeout(ctx, c.config.PacketTimeout) defer cf() ret := make(chan packets.ControlPacket, 1) - if err := c.Session.AddToSession(pubCtx, pb, ret); err != nil { + if err := c.config.Session.AddToSession(pubCtx, pb, ret); err != nil { return nil, err } // From this point on the message is in store, and ret will receive something regardless of whether we succeed in // writing the packet to the connection - if _, err := pb.WriteTo(c.Conn); err != nil { + if _, err := pb.WriteTo(c.config.Conn); err != nil { c.debug.Printf("failed to write packet %d to connection: %s", pb.PacketID, err) if o.Method == PublishMethod_AsyncSend { return nil, ErrNetworkErrorAfterStored // Async send, so we don't wait for the response (may add callbacks in the future to enable user to obtain status) @@ -909,7 +909,7 @@ func (c *Client) publishQoS12(ctx context.Context, pb *packets.Publish, o Publis } func (c *Client) expectConnack(packet chan<- *packets.Connack, errs chan<- error) { - recv, err := packets.ReadPacket(c.Conn) + recv, err := packets.ReadPacket(c.config.Conn) if err != nil { errs <- err return @@ -919,17 +919,17 @@ func (c *Client) expectConnack(packet chan<- *packets.Connack, errs chan<- error c.debug.Println("received CONNACK") if r.ReasonCode == packets.ConnackSuccess && r.Properties != nil && r.Properties.AuthMethod != "" { // Successful connack and AuthMethod is defined, must have successfully authed during connect - go c.AuthHandler.Authenticated() + go c.config.AuthHandler.Authenticated() } packet <- r case *packets.Auth: c.debug.Println("received AUTH") - if c.AuthHandler == nil { + if c.config.AuthHandler == nil { errs <- fmt.Errorf("enhanced authentication flow started but no AuthHandler configured") return } c.debug.Println("sending AUTH") - _, err := c.AuthHandler.Authenticate(AuthFromPacketAuth(r)).Packet().WriteTo(c.Conn) + _, err := c.config.AuthHandler.Authenticate(AuthFromPacketAuth(r)).Packet().WriteTo(c.config.Conn) if err != nil { errs <- fmt.Errorf("error sending authentication packet: %w", err) return @@ -948,7 +948,7 @@ func (c *Client) expectConnack(packet chan<- *packets.Connack, errs chan<- error // is closed. func (c *Client) Disconnect(d *Disconnect) error { c.debug.Println("disconnecting", d) - _, err := d.Packet().WriteTo(c.Conn) + _, err := d.Packet().WriteTo(c.config.Conn) c.close() @@ -990,12 +990,17 @@ idLoop: } } +// ClientID retrieves the client ID from the config (sometimes used in handlers that require the ID) +func (c *Client) ClientID() string { + return c.config.ClientID +} + // SetDebugLogger takes an instance of the paho Logger interface // and sets it to be used by the debug log endpoint func (c *Client) SetDebugLogger(l log.Logger) { c.debug = l - if c.autoCloseSession { // If we created the session store then it should use the same logger - c.Session.SetDebugLogger(l) + if c.config.autoCloseSession { // If we created the session store then it should use the same logger + c.config.Session.SetDebugLogger(l) } } @@ -1003,7 +1008,13 @@ func (c *Client) SetDebugLogger(l log.Logger) { // and sets it to be used by the error log endpoint func (c *Client) SetErrorLogger(l log.Logger) { c.errors = l - if c.autoCloseSession { // If we created the session store then it should use the same logger - c.Session.SetErrorLogger(l) + if c.config.autoCloseSession { // If we created the session store then it should use the same logger + c.config.Session.SetErrorLogger(l) } } + +// TerminateConnectionForTest closes the active connection (if any). This function is intended for testing only, it +// simulates connection loss which supports testing QOS1 and 2 message delivery. +func (c *Client) TerminateConnectionForTest() { + _ = c.config.Conn.Close() +} diff --git a/paho/client_test.go b/paho/client_test.go index 4888a2d..8043f25 100644 --- a/paho/client_test.go +++ b/paho/client_test.go @@ -23,9 +23,9 @@ func TestNewClient(t *testing.T) { c := NewClient(ClientConfig{}) require.NotNil(t, c) - require.NotNil(t, c.Session) - require.NotNil(t, c.Router) - require.NotNil(t, c.PingHandler) + require.NotNil(t, c.config.Session) + require.NotNil(t, c.config.Router) + require.NotNil(t, c.config.PingHandler) assert.Equal(t, uint16(65535), c.serverProps.ReceiveMaximum) assert.Equal(t, uint8(2), c.serverProps.MaximumQoS) @@ -41,7 +41,7 @@ func TestNewClient(t *testing.T) { assert.Equal(t, uint32(0), c.clientProps.MaximumPacketSize) assert.Equal(t, uint16(0), c.clientProps.TopicAliasMaximum) - assert.Equal(t, 10*time.Second, c.PacketTimeout) + assert.Equal(t, 10*time.Second, c.config.PacketTimeout) } func TestClientConnect(t *testing.T) { @@ -116,9 +116,9 @@ func TestClientSubscribe(t *testing.T) { }() go func() { defer c.workers.Done() - c.PingHandler.Start(c.Conn, 30*time.Second) + c.config.PingHandler.Start(c.config.Conn, 30*time.Second) }() - c.Session.ConAckReceived(c.Conn, &packets.Connect{}, &packets.Connack{}) + c.config.Session.ConAckReceived(c.config.Conn, &packets.Connect{}, &packets.Connack{}) s := &Subscribe{ Subscriptions: []SubscribeOptions{ @@ -161,9 +161,9 @@ func TestClientUnsubscribe(t *testing.T) { }() go func() { defer c.workers.Done() - c.PingHandler.Start(c.Conn, 30*time.Second) + c.config.PingHandler.Start(c.config.Conn, 30*time.Second) }() - c.Session.ConAckReceived(c.Conn, &packets.Connect{}, &packets.Connack{}) + c.config.Session.ConAckReceived(c.config.Conn, &packets.Connect{}, &packets.Connack{}) u := &Unsubscribe{ Topics: []string{ @@ -199,9 +199,9 @@ func TestClientPublishQoS0(t *testing.T) { }() go func() { defer c.workers.Done() - c.PingHandler.Start(c.Conn, 30*time.Second) + c.config.PingHandler.Start(c.config.Conn, 30*time.Second) }() - c.Session.ConAckReceived(c.Conn, &packets.Connect{}, &packets.Connack{}) + c.config.Session.ConAckReceived(c.config.Conn, &packets.Connect{}, &packets.Connack{}) p := &Publish{ Topic: "test/0", @@ -241,9 +241,9 @@ func TestClientPublishQoS1(t *testing.T) { }() go func() { defer c.workers.Done() - c.PingHandler.Start(c.Conn, 30*time.Second) + c.config.PingHandler.Start(c.config.Conn, 30*time.Second) }() - c.Session.ConAckReceived(c.Conn, &packets.Connect{}, &packets.Connack{}) + c.config.Session.ConAckReceived(c.config.Conn, &packets.Connect{}, &packets.Connack{}) p := &Publish{ Topic: "test/1", @@ -286,9 +286,9 @@ func TestClientPublishQoS2(t *testing.T) { }() go func() { defer c.workers.Done() - c.PingHandler.Start(c.Conn, 30*time.Second) + c.config.PingHandler.Start(c.config.Conn, 30*time.Second) }() - c.Session.ConAckReceived(c.Conn, &packets.Connect{}, &packets.Connack{}) + c.config.Session.ConAckReceived(c.config.Conn, &packets.Connect{}, &packets.Connack{}) p := &Publish{ Topic: "test/2", @@ -333,9 +333,9 @@ func TestClientReceiveQoS0(t *testing.T) { }() go func() { defer c.workers.Done() - c.PingHandler.Start(c.Conn, 30*time.Second) + c.config.PingHandler.Start(c.config.Conn, 30*time.Second) }() - c.Session.ConAckReceived(c.Conn, &packets.Connect{}, &packets.Connack{}) + c.config.Session.ConAckReceived(c.config.Conn, &packets.Connect{}, &packets.Connack{}) go c.routePublishPackets() err := ts.SendPacket(&packets.Publish{ @@ -380,9 +380,9 @@ func TestClientReceiveQoS1(t *testing.T) { }() go func() { defer c.workers.Done() - c.PingHandler.Start(c.Conn, 30*time.Second) + c.config.PingHandler.Start(c.config.Conn, 30*time.Second) }() - c.Session.ConAckReceived(c.Conn, &packets.Connect{}, &packets.Connack{}) + c.config.Session.ConAckReceived(c.config.Conn, &packets.Connect{}, &packets.Connack{}) go c.routePublishPackets() err := ts.SendPacket(&packets.Publish{ @@ -428,9 +428,9 @@ func TestClientReceiveQoS2(t *testing.T) { }() go func() { defer c.workers.Done() - c.PingHandler.Start(c.Conn, 30*time.Second) + c.config.PingHandler.Start(c.config.Conn, 30*time.Second) }() - c.Session.ConAckReceived(c.Conn, &packets.Connect{}, &packets.Connack{}) + c.config.Session.ConAckReceived(c.config.Conn, &packets.Connect{}, &packets.Connack{}) go c.routePublishPackets() err := ts.SendPacket(&packets.Publish{ @@ -645,9 +645,9 @@ func TestReceiveServerDisconnect(t *testing.T) { }() go func() { defer c.workers.Done() - c.PingHandler.Start(c.Conn, 30*time.Second) + c.config.PingHandler.Start(c.config.Conn, 30*time.Second) }() - c.Session.ConAckReceived(c.Conn, &packets.Connect{}, &packets.Connack{}) + c.config.Session.ConAckReceived(c.config.Conn, &packets.Connect{}, &packets.Connack{}) err := ts.SendPacket(&packets.Disconnect{ ReasonCode: packets.DisconnectServerShuttingDown, @@ -686,9 +686,9 @@ func TestAuthenticate(t *testing.T) { }() go func() { defer c.workers.Done() - c.PingHandler.Start(c.Conn, 30*time.Second) + c.config.PingHandler.Start(c.config.Conn, 30*time.Second) }() - c.Session.ConAckReceived(c.Conn, &packets.Connect{}, &packets.Connack{}) + c.config.Session.ConAckReceived(c.config.Conn, &packets.Connect{}, &packets.Connack{}) ctx, cf := context.WithTimeout(context.Background(), 5*time.Second) defer cf() diff --git a/paho/extensions/rpc/rpc.go b/paho/extensions/rpc/rpc.go index 02c3acc..2ce0e7e 100644 --- a/paho/extensions/rpc/rpc.go +++ b/paho/extensions/rpc/rpc.go @@ -23,7 +23,7 @@ func NewHandler(ctx context.Context, c *paho.Client) (*Handler, error) { correlData: make(map[string]chan *paho.Publish), } - responseTopic := fmt.Sprintf("%s/responses", c.ClientID) + responseTopic := fmt.Sprintf("%s/responses", c.ClientID()) c.AddOnPublishReceived(func(pr paho.PublishReceived) (bool, error) { if pr.Packet.Topic == responseTopic { h.responseHandler(pr.Packet) @@ -34,7 +34,7 @@ func NewHandler(ctx context.Context, c *paho.Client) (*Handler, error) { _, err := c.Subscribe(ctx, &paho.Subscribe{ Subscriptions: []paho.SubscribeOptions{ - {Topic: fmt.Sprintf("%s/responses", c.ClientID), QoS: 1}, + {Topic: fmt.Sprintf("%s/responses", c.ClientID()), QoS: 1}, }, }) if err != nil { @@ -72,7 +72,7 @@ func (h *Handler) Request(ctx context.Context, pb *paho.Publish) (*paho.Publish, } pb.Properties.CorrelationData = []byte(cID) - pb.Properties.ResponseTopic = fmt.Sprintf("%s/responses", h.c.ClientID) + pb.Properties.ResponseTopic = fmt.Sprintf("%s/responses", h.c.ClientID()) pb.Retain = false _, err := h.c.Publish(ctx, pb) diff --git a/paho/packet_ids_test.go b/paho/packet_ids_test.go index 4b0dd76..91410e0 100644 --- a/paho/packet_ids_test.go +++ b/paho/packet_ids_test.go @@ -31,8 +31,8 @@ func TestPackedIdNoExhaustion(t *testing.T) { c.stop = make(chan struct{}) c.publishPackets = make(chan *packets.Publish) go c.incoming() - go c.PingHandler.Start(c.Conn, 30*time.Second) - c.Session.ConAckReceived(c.Conn, &packets.Connect{}, &packets.Connack{}) + go c.config.PingHandler.Start(c.config.Conn, 30*time.Second) + c.config.Session.ConAckReceived(c.config.Conn, &packets.Connect{}, &packets.Connack{}) for i := 0; i < 70000; i++ { p := &Publish{ From 579a8db304d61ce14605f007120cb09fcb74a992 Mon Sep 17 00:00:00 2001 From: Matt Brittan Date: Thu, 11 Jan 2024 17:02:25 +1300 Subject: [PATCH 2/3] license - clarify licensing in line with Eclipse Paho standard Previously there was a LICENSE file (EPL-V2) and a DISTRIBUTION file (EDL-1); this was not completely clear (as pointed out in issue #223). This PR copies the license files from paho.mqtt.golang (which follow the standard set in the C library, with tweaks so pkg.go.dev will display the docs). The PR also introduces copyright headers in all Go files as required by the eclipse licensing documentation (https://www.eclipse.org/projects/tools/documentation.php?id=iot.paho). --- LICENSE | 21 +- autopaho/auto.go | 15 + autopaho/auto_test.go | 15 + autopaho/examples/basics/basics.go | 15 + autopaho/examples/docker/publisher/config.go | 15 + autopaho/examples/docker/publisher/main.go | 15 + autopaho/examples/docker/subscriber/config.go | 15 + autopaho/examples/docker/subscriber/main.go | 15 + .../docker/subscriber/message-handler.go | 15 + autopaho/examples/queue/logger.go | 15 + autopaho/examples/queue/main.go | 15 + autopaho/examples/queue/publish.go | 15 + autopaho/examples/queue/subscribe.go | 15 + autopaho/examples/router/router.go | 15 + autopaho/examples/rpc/main.go | 15 + autopaho/extensions/rpc/rpc.go | 15 + autopaho/net.go | 15 + autopaho/persistence_test.go | 15 + autopaho/queue/file/queue.go | 15 + autopaho/queue/file/queue_test.go | 15 + autopaho/queue/memory/queue.go | 15 + autopaho/queue/memory/queue_test.go | 15 + autopaho/queue/queue.go | 15 + autopaho/queue_test.go | 15 + DISTRIBUTION => edl-v10 | 2 +- epl-v20 | 277 ++++++++++++++++++ internal/basictestserver/server.go | 15 + internal/testserver/testserver.go | 15 + packets/auth.go | 15 + packets/connack.go | 15 + packets/connect.go | 15 + packets/disconnect.go | 15 + packets/packets.go | 15 + packets/packets_test.go | 15 + packets/pingreq.go | 15 + packets/pingresp.go | 15 + packets/properties.go | 15 + packets/properties_test.go | 15 + packets/puback.go | 15 + packets/pubcomp.go | 15 + packets/publish.go | 15 + packets/publish_test.go | 15 + packets/pubrec.go | 15 + packets/pubrel.go | 15 + packets/suback.go | 15 + packets/subscribe.go | 15 + packets/subscribe_test.go | 15 + packets/unsuback.go | 15 + packets/unsubscribe.go | 15 + paho/acks_tracker.go | 15 + paho/acks_tracker_test.go | 15 + paho/auth.go | 15 + paho/client.go | 15 + paho/client_test.go | 15 + paho/cmd/chat/main.go | 15 + paho/cmd/rpc/main.go | 15 + paho/cmd/stdinpub/main.go | 15 + paho/cmd/stdoutsub/main.go | 15 + paho/cp_auth.go | 15 + paho/cp_connack.go | 15 + paho/cp_connect.go | 15 + paho/cp_disconnect.go | 15 + paho/cp_publish.go | 15 + paho/cp_pubresp.go | 15 + paho/cp_suback.go | 15 + paho/cp_subscribe.go | 15 + paho/cp_unsuback.go | 15 + paho/cp_unsubscribe.go | 15 + paho/cp_utils.go | 15 + paho/extensions/rpc/rpc.go | 15 + paho/extensions/topicaliases/topicliases.go | 23 +- .../topicaliases/topicliases_test.go | 15 + paho/log/test.go | 15 + paho/log/trace.go | 15 + paho/packet_ids_test.go | 15 + paho/pinger.go | 15 + paho/router.go | 15 + paho/router_test.go | 15 + paho/session/session.go | 15 + paho/session/state/ids_test.go | 15 + paho/session/state/logger_test.go | 15 + paho/session/state/sendquota.go | 15 + paho/session/state/sendquota_test.go | 15 + paho/session/state/state.go | 15 + paho/session/state/store.go | 15 + paho/session/state/store_test.go | 15 + paho/store/file/store.go | 15 + paho/store/file/store_test.go | 15 + paho/store/memory/store.go | 15 + paho/store/memory/store_test.go | 15 + 90 files changed, 1606 insertions(+), 7 deletions(-) rename DISTRIBUTION => edl-v10 (100%) create mode 100644 epl-v20 diff --git a/LICENSE b/LICENSE index d3087e4..f55c395 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,20 @@ +Eclipse Public License - v 2.0 (EPL-2.0) + +This program and the accompanying materials +are made available under the terms of the Eclipse Public License v2.0 +and Eclipse Distribution License v1.0 which accompany this distribution. + +The Eclipse Public License is available at + https://www.eclipse.org/legal/epl-2.0/ +and the Eclipse Distribution License is available at + http://www.eclipse.org/org/documents/edl-v10.php. + +For an explanation of what dual-licensing means to you, see: +https://www.eclipse.org/legal/eplfaq.php#DUALLIC + +**** +The epl-2.0 is copied below in order to pass the pkg.go.dev license check (https://pkg.go.dev/license-policy). +**** Eclipse Public License - v 2.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE @@ -261,8 +278,8 @@ No third-party beneficiary rights are created under this Agreement. Exhibit A - Form of Secondary Licenses Notice -"This Source Code may also be made available under the following -Secondary Licenses when the conditions for such availability set forth +"This Source Code may also be made available under the following +Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), version(s), and exceptions or additional permissions here}." diff --git a/autopaho/auto.go b/autopaho/auto.go index 28bc9f2..5ae22d2 100644 --- a/autopaho/auto.go +++ b/autopaho/auto.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package autopaho import ( diff --git a/autopaho/auto_test.go b/autopaho/auto_test.go index 9c4fa92..dc7de3d 100644 --- a/autopaho/auto_test.go +++ b/autopaho/auto_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + // build +unittest package autopaho diff --git a/autopaho/examples/basics/basics.go b/autopaho/examples/basics/basics.go index 6bf2853..2eb1320 100644 --- a/autopaho/examples/basics/basics.go +++ b/autopaho/examples/basics/basics.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/autopaho/examples/docker/publisher/config.go b/autopaho/examples/docker/publisher/config.go index 3cb0a8e..5b901bf 100644 --- a/autopaho/examples/docker/publisher/config.go +++ b/autopaho/examples/docker/publisher/config.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/autopaho/examples/docker/publisher/main.go b/autopaho/examples/docker/publisher/main.go index b8f75ca..d2199a9 100644 --- a/autopaho/examples/docker/publisher/main.go +++ b/autopaho/examples/docker/publisher/main.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/autopaho/examples/docker/subscriber/config.go b/autopaho/examples/docker/subscriber/config.go index 8eb973a..48a28b1 100644 --- a/autopaho/examples/docker/subscriber/config.go +++ b/autopaho/examples/docker/subscriber/config.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/autopaho/examples/docker/subscriber/main.go b/autopaho/examples/docker/subscriber/main.go index d5d219b..15e16e0 100644 --- a/autopaho/examples/docker/subscriber/main.go +++ b/autopaho/examples/docker/subscriber/main.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main // Connect to the server, subscribe, and write messages received to a file diff --git a/autopaho/examples/docker/subscriber/message-handler.go b/autopaho/examples/docker/subscriber/message-handler.go index e14fd70..5535aa1 100644 --- a/autopaho/examples/docker/subscriber/message-handler.go +++ b/autopaho/examples/docker/subscriber/message-handler.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/autopaho/examples/queue/logger.go b/autopaho/examples/queue/logger.go index 87f90ae..81ac84c 100644 --- a/autopaho/examples/queue/logger.go +++ b/autopaho/examples/queue/logger.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import "fmt" diff --git a/autopaho/examples/queue/main.go b/autopaho/examples/queue/main.go index 1a8fdae..0c883c4 100644 --- a/autopaho/examples/queue/main.go +++ b/autopaho/examples/queue/main.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/autopaho/examples/queue/publish.go b/autopaho/examples/queue/publish.go index 8dec026..5826c98 100644 --- a/autopaho/examples/queue/publish.go +++ b/autopaho/examples/queue/publish.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/autopaho/examples/queue/subscribe.go b/autopaho/examples/queue/subscribe.go index c0bbe11..aa01932 100644 --- a/autopaho/examples/queue/subscribe.go +++ b/autopaho/examples/queue/subscribe.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/autopaho/examples/router/router.go b/autopaho/examples/router/router.go index 98d4aa2..4bb8a9a 100644 --- a/autopaho/examples/router/router.go +++ b/autopaho/examples/router/router.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/autopaho/examples/rpc/main.go b/autopaho/examples/rpc/main.go index e993c19..c290560 100644 --- a/autopaho/examples/rpc/main.go +++ b/autopaho/examples/rpc/main.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/autopaho/extensions/rpc/rpc.go b/autopaho/extensions/rpc/rpc.go index 26f288b..c702d05 100644 --- a/autopaho/extensions/rpc/rpc.go +++ b/autopaho/extensions/rpc/rpc.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package rpc import ( diff --git a/autopaho/net.go b/autopaho/net.go index 446c0e8..149241a 100644 --- a/autopaho/net.go +++ b/autopaho/net.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package autopaho import ( diff --git a/autopaho/persistence_test.go b/autopaho/persistence_test.go index d552234..0dad66c 100644 --- a/autopaho/persistence_test.go +++ b/autopaho/persistence_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package autopaho import ( diff --git a/autopaho/queue/file/queue.go b/autopaho/queue/file/queue.go index bee833e..36a5254 100644 --- a/autopaho/queue/file/queue.go +++ b/autopaho/queue/file/queue.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package file import ( diff --git a/autopaho/queue/file/queue_test.go b/autopaho/queue/file/queue_test.go index 747fe8b..c296381 100644 --- a/autopaho/queue/file/queue_test.go +++ b/autopaho/queue/file/queue_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package file import ( diff --git a/autopaho/queue/memory/queue.go b/autopaho/queue/memory/queue.go index ad9977c..92f44a9 100644 --- a/autopaho/queue/memory/queue.go +++ b/autopaho/queue/memory/queue.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package memory import ( diff --git a/autopaho/queue/memory/queue_test.go b/autopaho/queue/memory/queue_test.go index 23758f5..5394a8b 100644 --- a/autopaho/queue/memory/queue_test.go +++ b/autopaho/queue/memory/queue_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package memory import ( diff --git a/autopaho/queue/queue.go b/autopaho/queue/queue.go index 6ec559d..2fa4a91 100644 --- a/autopaho/queue/queue.go +++ b/autopaho/queue/queue.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package queue import ( diff --git a/autopaho/queue_test.go b/autopaho/queue_test.go index 0ab3497..84e350f 100644 --- a/autopaho/queue_test.go +++ b/autopaho/queue_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package autopaho import ( diff --git a/DISTRIBUTION b/edl-v10 similarity index 100% rename from DISTRIBUTION rename to edl-v10 index 34e4973..cf989f1 100644 --- a/DISTRIBUTION +++ b/edl-v10 @@ -1,5 +1,4 @@ - Eclipse Distribution License - v 1.0 Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. @@ -13,3 +12,4 @@ Redistribution and use in source and binary forms, with or without modification, Neither the name of the Eclipse Foundation, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + diff --git a/epl-v20 b/epl-v20 new file mode 100644 index 0000000..e55f344 --- /dev/null +++ b/epl-v20 @@ -0,0 +1,277 @@ +Eclipse Public License - v 2.0 + + THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE + PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION + OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + + a) in the case of the initial Contributor, the initial content + Distributed under this Agreement, and + + b) in the case of each subsequent Contributor: + i) changes to the Program, and + ii) additions to the Program; + where such changes and/or additions to the Program originate from + and are Distributed by that particular Contributor. A Contribution + "originates" from a Contributor if it was added to the Program by + such Contributor itself or anyone acting on such Contributor's behalf. + Contributions do not include changes or additions to the Program that + are not Modified Works. + +"Contributor" means any person or entity that Distributes the Program. + +"Licensed Patents" mean patent claims licensable by a Contributor which +are necessarily infringed by the use or sale of its Contribution alone +or when combined with the Program. + +"Program" means the Contributions Distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this Agreement +or any Secondary License (as applicable), including Contributors. + +"Derivative Works" shall mean any work, whether in Source Code or other +form, that is based on (or derived from) the Program and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. + +"Modified Works" shall mean any work in Source Code or other form that +results from an addition to, deletion from, or modification of the +contents of the Program, including, for purposes of clarity any new file +in Source Code form that contains any contents of the Program. Modified +Works shall not include works that contain only declarations, +interfaces, types, classes, structures, or files of the Program solely +in each case in order to link to, bind by name, or subclass the Program +or Modified Works thereof. + +"Distribute" means the acts of a) distributing or b) making available +in any manner that enables the transfer of a copy. + +"Source Code" means the form of a Program preferred for making +modifications, including but not limited to software source code, +documentation source, and configuration files. + +"Secondary License" means either the GNU General Public License, +Version 2.0, or any later versions of that license, including any +exceptions or additional permissions as identified by the initial +Contributor. + +2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free copyright + license to reproduce, prepare Derivative Works of, publicly display, + publicly perform, Distribute and sublicense the Contribution of such + Contributor, if any, and such Derivative Works. + + b) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free patent + license under Licensed Patents to make, use, sell, offer to sell, + import and otherwise transfer the Contribution of such Contributor, + if any, in Source Code or other form. This patent license shall + apply to the combination of the Contribution and the Program if, at + the time the Contribution is added by the Contributor, such addition + of the Contribution causes such combination to be covered by the + Licensed Patents. The patent license shall not apply to any other + combinations which include the Contribution. No hardware per se is + licensed hereunder. + + c) Recipient understands that although each Contributor grants the + licenses to its Contributions set forth herein, no assurances are + provided by any Contributor that the Program does not infringe the + patent or other intellectual property rights of any other entity. + Each Contributor disclaims any liability to Recipient for claims + brought by any other entity based on infringement of intellectual + property rights or otherwise. As a condition to exercising the + rights and licenses granted hereunder, each Recipient hereby + assumes sole responsibility to secure any other intellectual + property rights needed, if any. For example, if a third party + patent license is required to allow Recipient to Distribute the + Program, it is Recipient's responsibility to acquire that license + before distributing the Program. + + d) Each Contributor represents that to its knowledge it has + sufficient copyright rights in its Contribution, if any, to grant + the copyright license set forth in this Agreement. + + e) Notwithstanding the terms of any Secondary License, no + Contributor makes additional grants to any Recipient (other than + those set forth in this Agreement) as a result of such Recipient's + receipt of the Program under the terms of a Secondary License + (if permitted under the terms of Section 3). + +3. REQUIREMENTS + +3.1 If a Contributor Distributes the Program in any form, then: + + a) the Program must also be made available as Source Code, in + accordance with section 3.2, and the Contributor must accompany + the Program with a statement that the Source Code for the Program + is available under this Agreement, and informs Recipients how to + obtain it in a reasonable manner on or through a medium customarily + used for software exchange; and + + b) the Contributor may Distribute the Program under a license + different than this Agreement, provided that such license: + i) effectively disclaims on behalf of all other Contributors all + warranties and conditions, express and implied, including + warranties or conditions of title and non-infringement, and + implied warranties or conditions of merchantability and fitness + for a particular purpose; + + ii) effectively excludes on behalf of all other Contributors all + liability for damages, including direct, indirect, special, + incidental and consequential damages, such as lost profits; + + iii) does not attempt to limit or alter the recipients' rights + in the Source Code under section 3.2; and + + iv) requires any subsequent distribution of the Program by any + party to be under a license that satisfies the requirements + of this section 3. + +3.2 When the Program is Distributed as Source Code: + + a) it must be made available under this Agreement, or if the + Program (i) is combined with other material in a separate file or + files made available under a Secondary License, and (ii) the initial + Contributor attached to the Source Code the notice described in + Exhibit A of this Agreement, then the Program may be made available + under the terms of such Secondary Licenses, and + + b) a copy of this Agreement must be included with each copy of + the Program. + +3.3 Contributors may not remove or alter any copyright, patent, +trademark, attribution notices, disclaimers of warranty, or limitations +of liability ("notices") contained within the Program from any copy of +the Program which they Distribute, provided that Contributors may add +their own appropriate notices. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities +with respect to end users, business partners and the like. While this +license is intended to facilitate the commercial use of the Program, +the Contributor who includes the Program in a commercial product +offering should do so in a manner which does not create potential +liability for other Contributors. Therefore, if a Contributor includes +the Program in a commercial product offering, such Contributor +("Commercial Contributor") hereby agrees to defend and indemnify every +other Contributor ("Indemnified Contributor") against any losses, +damages and costs (collectively "Losses") arising from claims, lawsuits +and other legal actions brought by a third party against the Indemnified +Contributor to the extent caused by the acts or omissions of such +Commercial Contributor in connection with its distribution of the Program +in a commercial product offering. The obligations in this section do not +apply to any claims or Losses relating to any actual or alleged +intellectual property infringement. In order to qualify, an Indemnified +Contributor must: a) promptly notify the Commercial Contributor in +writing of such claim, and b) allow the Commercial Contributor to control, +and cooperate with the Commercial Contributor in, the defense and any +related settlement negotiations. The Indemnified Contributor may +participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those performance +claims and warranties, and if a court requires any other Contributor to +pay any damages as a result, the Commercial Contributor must pay +those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" +BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF +TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR +PURPOSE. Each Recipient is solely responsible for determining the +appropriateness of using and distributing the Program and assumes all +risks associated with its exercise of rights under this Agreement, +including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs +or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS +SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST +PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE +EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the +Program itself (excluding combinations of the Program with other software +or hardware) infringes such Recipient's patent(s), then such Recipient's +rights granted under Section 2(b) shall terminate as of the date such +litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign the +responsibility to serve as the Agreement Steward to a suitable separate +entity. Each new version of the Agreement will be given a distinguishing +version number. The Program (including Contributions) may always be +Distributed subject to the version of the Agreement under which it was +received. In addition, after a new version of the Agreement is published, +Contributor may elect to Distribute the Program (including its +Contributions) under the new version. + +Except as expressly stated in Sections 2(a) and 2(b) above, Recipient +receives no rights or licenses to the intellectual property of any +Contributor under this Agreement, whether expressly, by implication, +estoppel or otherwise. All rights in the Program not expressly granted +under this Agreement are reserved. Nothing in this Agreement is intended +to be enforceable by any entity that is not a Contributor or Recipient. +No third-party beneficiary rights are created under this Agreement. + +Exhibit A - Form of Secondary Licenses Notice + +"This Source Code may also be made available under the following +Secondary Licenses when the conditions for such availability set forth +in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), +version(s), and exceptions or additional permissions here}." + + Simply including a copy of this Agreement, including this Exhibit A + is not sufficient to license the Source Code under Secondary Licenses. + + If it is not possible or desirable to put the notice in a particular + file, then You may include the notice in a location (such as a LICENSE + file in a relevant directory) where a recipient would be likely to + look for such a notice. + + You may add additional accurate notices of copyright ownership. \ No newline at end of file diff --git a/internal/basictestserver/server.go b/internal/basictestserver/server.go index c617ba2..05fa36e 100644 --- a/internal/basictestserver/server.go +++ b/internal/basictestserver/server.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package basictestserver import ( diff --git a/internal/testserver/testserver.go b/internal/testserver/testserver.go index 390ccf1..a7724ef 100644 --- a/internal/testserver/testserver.go +++ b/internal/testserver/testserver.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package testserver import ( diff --git a/packets/auth.go b/packets/auth.go index 56237e0..c97446f 100644 --- a/packets/auth.go +++ b/packets/auth.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/connack.go b/packets/connack.go index 3f809b1..493aa29 100644 --- a/packets/connack.go +++ b/packets/connack.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/connect.go b/packets/connect.go index 3308b18..2394e7d 100644 --- a/packets/connect.go +++ b/packets/connect.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/disconnect.go b/packets/disconnect.go index 9180207..693abfd 100644 --- a/packets/disconnect.go +++ b/packets/disconnect.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/packets.go b/packets/packets.go index 4f023e0..48dc546 100644 --- a/packets/packets.go +++ b/packets/packets.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/packets_test.go b/packets/packets_test.go index b94c14f..7ec4220 100644 --- a/packets/packets_test.go +++ b/packets/packets_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/pingreq.go b/packets/pingreq.go index 27d39ee..b6a4c7f 100644 --- a/packets/pingreq.go +++ b/packets/pingreq.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/pingresp.go b/packets/pingresp.go index fcf421a..f5210f1 100644 --- a/packets/pingresp.go +++ b/packets/pingresp.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/properties.go b/packets/properties.go index 5a74e05..450698d 100644 --- a/packets/properties.go +++ b/packets/properties.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/properties_test.go b/packets/properties_test.go index 45e68f0..4646235 100644 --- a/packets/properties_test.go +++ b/packets/properties_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/puback.go b/packets/puback.go index 93cf7c0..57e6f34 100644 --- a/packets/puback.go +++ b/packets/puback.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/pubcomp.go b/packets/pubcomp.go index 4e383f7..b193be0 100644 --- a/packets/pubcomp.go +++ b/packets/pubcomp.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/publish.go b/packets/publish.go index 24edb58..150ea34 100644 --- a/packets/publish.go +++ b/packets/publish.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/publish_test.go b/packets/publish_test.go index eb5e73a..045722a 100644 --- a/packets/publish_test.go +++ b/packets/publish_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/pubrec.go b/packets/pubrec.go index 7bd3045..f162796 100644 --- a/packets/pubrec.go +++ b/packets/pubrec.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/pubrel.go b/packets/pubrel.go index 4f854d0..1f8ea94 100644 --- a/packets/pubrel.go +++ b/packets/pubrel.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/suback.go b/packets/suback.go index c401cc6..be5eaaa 100644 --- a/packets/suback.go +++ b/packets/suback.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/subscribe.go b/packets/subscribe.go index 2abccbb..c179e4e 100644 --- a/packets/subscribe.go +++ b/packets/subscribe.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/subscribe_test.go b/packets/subscribe_test.go index 714a85b..b5bcfab 100644 --- a/packets/subscribe_test.go +++ b/packets/subscribe_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/unsuback.go b/packets/unsuback.go index ba5164b..264ebce 100644 --- a/packets/unsuback.go +++ b/packets/unsuback.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/packets/unsubscribe.go b/packets/unsubscribe.go index 090d7ca..4af1bc5 100644 --- a/packets/unsubscribe.go +++ b/packets/unsubscribe.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package packets import ( diff --git a/paho/acks_tracker.go b/paho/acks_tracker.go index 47f11cb..d4077b0 100644 --- a/paho/acks_tracker.go +++ b/paho/acks_tracker.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import ( diff --git a/paho/acks_tracker_test.go b/paho/acks_tracker_test.go index 15f1839..e5b6c17 100644 --- a/paho/acks_tracker_test.go +++ b/paho/acks_tracker_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import ( diff --git a/paho/auth.go b/paho/auth.go index b3b4256..3ab6496 100644 --- a/paho/auth.go +++ b/paho/auth.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho // Auther is the interface for something that implements the extended authentication diff --git a/paho/client.go b/paho/client.go index 94b3ae9..4ef2640 100644 --- a/paho/client.go +++ b/paho/client.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import ( diff --git a/paho/client_test.go b/paho/client_test.go index 8043f25..2b5f215 100644 --- a/paho/client_test.go +++ b/paho/client_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import ( diff --git a/paho/cmd/chat/main.go b/paho/cmd/chat/main.go index ddf47e1..6caa0fa 100644 --- a/paho/cmd/chat/main.go +++ b/paho/cmd/chat/main.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/paho/cmd/rpc/main.go b/paho/cmd/rpc/main.go index b5e6d72..fc1129e 100644 --- a/paho/cmd/rpc/main.go +++ b/paho/cmd/rpc/main.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/paho/cmd/stdinpub/main.go b/paho/cmd/stdinpub/main.go index adfad8e..7b83646 100644 --- a/paho/cmd/stdinpub/main.go +++ b/paho/cmd/stdinpub/main.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/paho/cmd/stdoutsub/main.go b/paho/cmd/stdoutsub/main.go index caa1866..ed7f90a 100644 --- a/paho/cmd/stdoutsub/main.go +++ b/paho/cmd/stdoutsub/main.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package main import ( diff --git a/paho/cp_auth.go b/paho/cp_auth.go index 6ccef9b..46b64f8 100644 --- a/paho/cp_auth.go +++ b/paho/cp_auth.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import "github.com/eclipse/paho.golang/packets" diff --git a/paho/cp_connack.go b/paho/cp_connack.go index 2a525eb..ef8a586 100644 --- a/paho/cp_connack.go +++ b/paho/cp_connack.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import ( diff --git a/paho/cp_connect.go b/paho/cp_connect.go index 8d73176..371ea4d 100644 --- a/paho/cp_connect.go +++ b/paho/cp_connect.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import "github.com/eclipse/paho.golang/packets" diff --git a/paho/cp_disconnect.go b/paho/cp_disconnect.go index 5caa85b..ac5931c 100644 --- a/paho/cp_disconnect.go +++ b/paho/cp_disconnect.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import "github.com/eclipse/paho.golang/packets" diff --git a/paho/cp_publish.go b/paho/cp_publish.go index 57b218f..7f845e3 100644 --- a/paho/cp_publish.go +++ b/paho/cp_publish.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import ( diff --git a/paho/cp_pubresp.go b/paho/cp_pubresp.go index 0c4e174..bf47fca 100644 --- a/paho/cp_pubresp.go +++ b/paho/cp_pubresp.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import "github.com/eclipse/paho.golang/packets" diff --git a/paho/cp_suback.go b/paho/cp_suback.go index c1034c2..f9bce03 100644 --- a/paho/cp_suback.go +++ b/paho/cp_suback.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import "github.com/eclipse/paho.golang/packets" diff --git a/paho/cp_subscribe.go b/paho/cp_subscribe.go index 52dc540..04298ac 100644 --- a/paho/cp_subscribe.go +++ b/paho/cp_subscribe.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import "github.com/eclipse/paho.golang/packets" diff --git a/paho/cp_unsuback.go b/paho/cp_unsuback.go index 15ca838..d9f1ad2 100644 --- a/paho/cp_unsuback.go +++ b/paho/cp_unsuback.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import "github.com/eclipse/paho.golang/packets" diff --git a/paho/cp_unsubscribe.go b/paho/cp_unsubscribe.go index 375b917..ff20acf 100644 --- a/paho/cp_unsubscribe.go +++ b/paho/cp_unsubscribe.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import "github.com/eclipse/paho.golang/packets" diff --git a/paho/cp_utils.go b/paho/cp_utils.go index 2d7995f..a1ca35e 100644 --- a/paho/cp_utils.go +++ b/paho/cp_utils.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import ( diff --git a/paho/extensions/rpc/rpc.go b/paho/extensions/rpc/rpc.go index 2ce0e7e..d93544a 100644 --- a/paho/extensions/rpc/rpc.go +++ b/paho/extensions/rpc/rpc.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package rpc import ( diff --git a/paho/extensions/topicaliases/topicliases.go b/paho/extensions/topicaliases/topicliases.go index bbedd9a..29d988d 100644 --- a/paho/extensions/topicaliases/topicliases.go +++ b/paho/extensions/topicaliases/topicliases.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package topicaliases import ( @@ -69,14 +84,14 @@ func (t *TAHandler) ResetAlias(topic string, a uint16) { // In this case it allows the Topic Alias Handler to automatically replace topic // names with alias numbers func (t *TAHandler) PublishHook(p *paho.Publish) { - //p.Topic is always not "" as the default publish checks before calling hooks + // p.Topic is always not "" as the default publish checks before calling hooks if p.Properties != nil && p.Properties.TopicAlias != nil { - //topic string is not empty and topic alias is set, reset the alias value. + // topic string is not empty and topic alias is set, reset the alias value. t.ResetAlias(p.Topic, *p.Properties.TopicAlias) return } - //we already have an alias, set it and unset the topic + // we already have an alias, set it and unset the topic if a := t.GetAlias(p.Topic); a != 0 { if p.Properties == nil { p.Properties = &paho.PublishProperties{} @@ -86,7 +101,7 @@ func (t *TAHandler) PublishHook(p *paho.Publish) { return } - //we don't have an alias, try and get one + // we don't have an alias, try and get one if a := t.SetAlias(p.Topic); a != 0 { if p.Properties == nil { p.Properties = &paho.PublishProperties{} diff --git a/paho/extensions/topicaliases/topicliases_test.go b/paho/extensions/topicaliases/topicliases_test.go index efcf050..65645a7 100644 --- a/paho/extensions/topicaliases/topicliases_test.go +++ b/paho/extensions/topicaliases/topicliases_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package topicaliases import ( diff --git a/paho/log/test.go b/paho/log/test.go index 7f2aa23..4e8ff4d 100644 --- a/paho/log/test.go +++ b/paho/log/test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package log import ( diff --git a/paho/log/trace.go b/paho/log/trace.go index d8df391..8363f72 100644 --- a/paho/log/trace.go +++ b/paho/log/trace.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package log type ( diff --git a/paho/packet_ids_test.go b/paho/packet_ids_test.go index 91410e0..d28b029 100644 --- a/paho/packet_ids_test.go +++ b/paho/packet_ids_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import ( diff --git a/paho/pinger.go b/paho/pinger.go index 5019305..5f2096d 100644 --- a/paho/pinger.go +++ b/paho/pinger.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import ( diff --git a/paho/router.go b/paho/router.go index ce9fdda..dc6fa70 100644 --- a/paho/router.go +++ b/paho/router.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import ( diff --git a/paho/router_test.go b/paho/router_test.go index 4feb016..2001ab1 100644 --- a/paho/router_test.go +++ b/paho/router_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package paho import ( diff --git a/paho/session/session.go b/paho/session/session.go index a13d3dd..a8d4a53 100644 --- a/paho/session/session.go +++ b/paho/session/session.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package session import ( diff --git a/paho/session/state/ids_test.go b/paho/session/state/ids_test.go index 0ac7d03..127381b 100644 --- a/paho/session/state/ids_test.go +++ b/paho/session/state/ids_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package state import ( diff --git a/paho/session/state/logger_test.go b/paho/session/state/logger_test.go index cfa8728..faa3f14 100644 --- a/paho/session/state/logger_test.go +++ b/paho/session/state/logger_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package state import "sync" diff --git a/paho/session/state/sendquota.go b/paho/session/state/sendquota.go index 9f255fa..d48f053 100644 --- a/paho/session/state/sendquota.go +++ b/paho/session/state/sendquota.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package state import ( diff --git a/paho/session/state/sendquota_test.go b/paho/session/state/sendquota_test.go index f273bf0..3636cdc 100644 --- a/paho/session/state/sendquota_test.go +++ b/paho/session/state/sendquota_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package state import ( diff --git a/paho/session/state/state.go b/paho/session/state/state.go index 9b79a2c..bd19704 100644 --- a/paho/session/state/state.go +++ b/paho/session/state/state.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package state import ( diff --git a/paho/session/state/store.go b/paho/session/state/store.go index b6617df..b31a8e5 100644 --- a/paho/session/state/store.go +++ b/paho/session/state/store.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package state import ( diff --git a/paho/session/state/store_test.go b/paho/session/state/store_test.go index 68f4ced..5365def 100644 --- a/paho/session/state/store_test.go +++ b/paho/session/state/store_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package state import ( diff --git a/paho/store/file/store.go b/paho/store/file/store.go index ed82547..2f4e39a 100644 --- a/paho/store/file/store.go +++ b/paho/store/file/store.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package file import ( diff --git a/paho/store/file/store_test.go b/paho/store/file/store_test.go index 4d147cf..25477b8 100644 --- a/paho/store/file/store_test.go +++ b/paho/store/file/store_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package file import ( diff --git a/paho/store/memory/store.go b/paho/store/memory/store.go index fc608e2..03c52fe 100644 --- a/paho/store/memory/store.go +++ b/paho/store/memory/store.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package memory import ( diff --git a/paho/store/memory/store_test.go b/paho/store/memory/store_test.go index c2719bb..862b8c9 100644 --- a/paho/store/memory/store_test.go +++ b/paho/store/memory/store_test.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package memory import ( From ab41cf6017fff23499f8cffaca6b6345539b69f6 Mon Sep 17 00:00:00 2001 From: Matt Brittan Date: Thu, 11 Jan 2024 17:15:18 +1300 Subject: [PATCH 3/3] license - clarify licensing in line with Eclipse Paho standard Previously there was a LICENSE file (EPL-V2) and a DISTRIBUTION file (EDL-1); this was not completely clear (as pointed out in issue #223). This PR copies the license files from paho.mqtt.golang (which follow the standard set in the C library, with tweaks so pkg.go.dev will display the docs). The PR also introduces copyright headers in all Go files as required by the eclipse licensing documentation (https://www.eclipse.org/projects/tools/documentation.php?id=iot.paho). --- autopaho/error.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/autopaho/error.go b/autopaho/error.go index f042106..b22f732 100644 --- a/autopaho/error.go +++ b/autopaho/error.go @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2024 Contributors to the Eclipse Foundation + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * https://www.eclipse.org/legal/epl-2.0/ + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause + */ + package autopaho import (